Example #1
0
def strip_tags(html):
    """
    Remove tags from HTML
    """
    s = MLStripper()
    s.feed(html)
    return s.get_data()
Example #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
Example #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
Example #4
0
 def __init__(self, wrap):
     self.WRAP = wrap
     self.HS = MLStripper()
Example #5
0
 def __init__(self, wrap):
     self.WRAP = wrap
     self.HS = MLStripper()