Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib2
- import re
- #connect to a URL
- url = raw_input('Enter url > ')
- website = urllib2.urlopen(url)
- #read html code
- html = website.read()
- #use re.findall to get all the links
- links = re.findall('"((http|ftp)s?://.*?)"', html)
- for a in links:
- if ("htm" in a[0]) and ('dtd' not in a[0]) and ('xhtml' not in a[0]):
- print a[0]
Advertisement
Add Comment
Please, Sign In to add comment