Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save polishdeveloper/25f8ccb971355454e8596f5bc743f42b to your computer and use it in GitHub Desktop.
Save polishdeveloper/25f8ccb971355454e8596f5bc743f42b 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