Created
February 28, 2011 19:37
-
-
Save fadur/847879 to your computer and use it in GitHub Desktop.
Strips html tags from a given webpage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import urllib | |
""" | |
strip html tags from a webpage | |
need's regex to remove js too | |
""" | |
url = '' | |
def strip_tags(url): | |
link = urllib.urlopen(url) | |
data = link.read() | |
stripped = re.compile(r'<[^<]*?/?>') | |
content = stripped.sub('', data) | |
return content | |
print strip_tags(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment