Skip to content

Instantly share code, notes, and snippets.

Created March 31, 2017 21:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/2d97aae43b19156ee51cce7552dc8dac to your computer and use it in GitHub Desktop.
Save anonymous/2d97aae43b19156ee51cce7552dc8dac to your computer and use it in GitHub Desktop.
Listen to wikipedia
curl -s "https://en.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&generator=random&redirects=1&exsentences=2&exlimit=1&explaintext=1&exsectionformat=plain&grnnamespace=0&grnfilterredir=nonredirects&formatversion=2" | python -c 'import sys, json; resp = json.load(sys.stdin); print unicode(resp["query"]["pages"][0]["title"] + ". " + resp["query"]["pages"][0]["extract"]).encode("utf-8")'| say
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment