Skip to content

Instantly share code, notes, and snippets.

@dmil
Created March 28, 2015 19:56
Show Gist options
  • Save dmil/42b1cd35f3fe0a89eb6d to your computer and use it in GitHub Desktop.
Save dmil/42b1cd35f3fe0a89eb6d to your computer and use it in GitHub Desktop.
Scraper Stub
"""
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