Created
March 28, 2015 19:56
-
-
Save dmil/f4da4d19196c39018e04 to your computer and use it in GitHub Desktop.
Scraper Stub
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
""" | |
Stub for scraping-related jobs | |
CSS Selectors Reference: http://www.w3schools.com/cssref/css_selectors.asp | |
""" | |
import requests, lxml.html | |
# Grab HTML from page | |
response = requests.get('https://www.google.com/') | |
doc = lxml.html.fromstring(response.content) | |
# Select the element using a CSS Selector | |
element = doc.cssselect("#hplogo")[0] | |
# Print element | |
print lxml.html.tostring(element) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment