Skip to content

Instantly share code, notes, and snippets.

@tyjak
Created May 24, 2021 10:51
Show Gist options
  • Save tyjak/e4eb7bf3ed820cbd24b2be1da71f1068 to your computer and use it in GitHub Desktop.
Save tyjak/e4eb7bf3ed820cbd24b2be1da71f1068 to your computer and use it in GitHub Desktop.
#!/bin/zsh
# GistID: e4eb7bf3ed820cbd24b2be1da71f1068
# Get text of the first result of a wikipedia search as argument
# Dependencies: http, jq, sed
http https://fr.wikipedia.org/w/api.php\?format\=json\&action\=query\&generator\=search\&gsrsearch\=$1\&gsrlimit\=1\&prop\=extracts\&explaintext\=1 | jq '.query.pages | map(values) | .[0].extract' | sed 's/\\n/\n/g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment