Skip to content

Instantly share code, notes, and snippets.

@d-schmidt
Last active July 18, 2018 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d-schmidt/fbe5818664353597dad57bffdbdae26e to your computer and use it in GitHub Desktop.
Save d-schmidt/fbe5818664353597dad57bffdbdae26e to your computer and use it in GitHub Desktop.
Simple HTML parsing with python requests and lxml
import requests
import lxml.html
t = requests.get("https://www.hearthpwn.com/news/5425-final-witchwood-card-reveal-stream-live-updates").text
html = lxml.html.fromstring(t)
links = html.xpath("//span/span[@class='pretty-bg']/a")
for link in links:
print(link.get("href"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment