Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 14th, 2012  |  syntax: None  |  size: 0.28 KB  |  views: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.         dom = BeautifulSoup(untrusted_html)
  2.  
  3.         def cleanHtml(dom):
  4.             for a in dom.findAll('a'):
  5.                 a['rel'] = "nofollow"
  6.  
  7.             map(lambda x: x.extract(), dom.findAll(['script', 'object', 'link', 'style']))
  8.             return unicode(dom)