Created
October 1, 2015 10:06
-
-
Save averrin/9416a682f80e96c78827 to your computer and use it in GitHub Desktop.
Fetch popular UAs
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
#!env python3 | |
import requests | |
from lxml import html | |
page = requests.get('https://techblog.willshouse.com/2012/01/03/most-common-user-agents/') | |
page = html.fromstring(page.text) | |
path = '//*[@id="post-2229"]/div[2]/table/tbody' | |
table = page.xpath(path)[0] | |
for row in table[:10]: | |
ua = row[1].text_content() | |
browser = row[2].text_content() | |
print('%s: %s' % (browser, ua)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment