Created
December 1, 2016 07:26
-
-
Save eliask/79af8dbb8737d640da24f5e4892c0b97 to your computer and use it in GitHub Desktop.
Auto-complete from command-line (bash) using Google Autocomplete API.
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
function c() { | |
url='https://www.google.com/complete/search?client=hp&hl=en&xhr=t' | |
# NB: user-agent must be specified to get back UTF-8 data! | |
curl -H 'user-agent: Mozilla/5.0' -sSG --data-urlencode "q=$*" "$url" | | |
jq -r .[1][][0] | | |
sed 's,</\?b>,,g' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment