Advertisement
opexxx

get_all_links.py

Mar 31st, 2015
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. import urllib2
  2. import re
  3.  
  4. #connect to a URL
  5. website = urllib2.urlopen("url")
  6.  
  7. #read html code
  8. html = website.read()
  9.  
  10. #use re.findall to get all the links
  11. links = re.findall('"((http|ftp)s?://.*?)"', html)
  12.  
  13. print links
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement