Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dom = BeautifulSoup(untrusted_html)
- def cleanHtml(dom):
- for a in dom.findAll('a'):
- a['rel'] = "nofollow"
- map(lambda x: x.extract(), dom.findAll(['script', 'object', 'link', 'style']))
- return unicode(dom)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement