-
-
Save ruvasik/d22977fa0d7a87d1ca0fd32e5545cab4 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