Created
July 19, 2016 11:17
-
-
Save doekman/834a0d6a9c6e9598a42ca647462cf6da to your computer and use it in GitHub Desktop.
Opens one item from secretGeek's best-of-wikipedia listing in your favorite browser.
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
#!/usr/bin/env python3 | |
# Tested on OS X | |
from lxml import html | |
import requests | |
import random | |
from subprocess import call | |
page = requests.get('http://wiki.secretgeek.net/best-of-wikipedia') | |
tree = html.fromstring(page.content) | |
links = tree.xpath('//article/ul/li/a/@href') | |
call(["open", random.choice(links)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment