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