Created
April 21, 2014 08:17
-
-
Save juanriaza/11135970 to your computer and use it in GitHub Desktop.
This file contains 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 requests | |
from lxml.html import fromstring, iterlinks | |
# https://github.com/zacharyvoase/urlobject/ | |
from urlobject import URLObject | |
url = 'http://juanriaza.com' | |
req = requests.get(url, verify=False) | |
html_tree = fromstring(req.content) | |
html_tree.make_links_absolute(url, resolve_base_href=True) | |
for link in iterlinks(html_tree): | |
print link | |
print URLObject(link[2]).hostname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment