Created
June 23, 2015 17:35
-
-
Save jorpic/6ac252b5ef3025b77bfc to your computer and use it in GitHub Desktop.
Get random fact from wikipedia
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
#!/bin/bash -e | |
API="http://en.wikipedia.org/w/api.php\ | |
?action=query\ | |
&prop=extracts\ | |
&format=json\ | |
&exsentences=2\ | |
&explaintext=\ | |
&exsectionformat=plain\ | |
&rawcontinue=\ | |
&generator=random\ | |
&grnnamespace=0" | |
MSG=`curl -L -s "$API" | jq -r '.query.pages | to_entries[] | .value.extract'` | |
echo $MSG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment