Beispiel #1
0
def strip_tags(html):
    """
    Remove tags from HTML
    """
    s = MLStripper()
    s.feed(html)
    return s.get_data()
Beispiel #2
0
class Printer():
    def __init__(self, wrap):
        self.WRAP = wrap
        self.HS = MLStripper()
    
    def printText(self, text):
        print Fore.WHITE + text
        
    def printLink(self, text, viewed):
        if not viewed:
            print Fore.WHITE + text
        else:
            print Fore.MAGENTA + text
            
    def printStatus(self, text):
        print Fore.GREEN + text
        
    def printEntry(self, entry):
        print '\n'
        try:
            summary = entry['summary']
            try:
                print Fore.WHITE + textwrap.fill(
                        self.HS.strip_tags(summary[:summary.find('<br')]),80)
                print '\n'
            except:
                print Fore.WHITE + textwrap.fill((summary + '\n'),80)
        except:
            pass
        try:
            print Fore.WHITE + entry['author'] 
        except:
            pass
        try:
            print Fore.WHITE + entry['published'] 
        except:
            pass
        print '\n\n'
            
    def printError(self, text):
        print Fore.RED + text
Beispiel #3
0
class Printer():
    def __init__(self, wrap):
        self.WRAP = wrap
        self.HS = MLStripper()

    def printText(self, text):
        print Fore.WHITE + text

    def printLink(self, text, viewed):
        if not viewed:
            print Fore.WHITE + text
        else:
            print Fore.MAGENTA + text

    def printStatus(self, text):
        print Fore.GREEN + text

    def printEntry(self, entry):
        print '\n'
        try:
            summary = entry['summary']
            try:
                print Fore.WHITE + textwrap.fill(
                    self.HS.strip_tags(summary[:summary.find('<br')]), 80)
                print '\n'
            except:
                print Fore.WHITE + textwrap.fill((summary + '\n'), 80)
        except:
            pass
        try:
            print Fore.WHITE + entry['author']
        except:
            pass
        try:
            print Fore.WHITE + entry['published']
        except:
            pass
        print '\n\n'

    def printError(self, text):
        print Fore.RED + text
Beispiel #4
0
 def __init__(self, wrap):
     self.WRAP = wrap
     self.HS = MLStripper()
Beispiel #5
0
 def __init__(self, wrap):
     self.WRAP = wrap
     self.HS = MLStripper()