SHARE
TWEET

Untitled

a guest Jul 14th, 2012 18 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top