Skip to content

Instantly share code, notes, and snippets.

@dewomser
Created July 15, 2023 16:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dewomser/aa12dff5724d12fa1e24b94251e785fe to your computer and use it in GitHub Desktop.
google search CLI
#!/bin/bash
# /usr/bin/shellcheck "${0##*/}"
echo -e '\e[38mG\e[m' '\e[31mo\e[m' '\e[33mo\e[m' '\e[38mg\e[m' '\e[32ml\e[m' '\e[31me\e[m'
if [[ -z $1 ]] ; then
read -p "Suche: " query ;lynx -dump --display_charset=utf-8 "http://google.com/search?q=$(echo $query | sed 's/ /+/g')"|grep '^[[:blank:]][[:blank:]].[[:digit:]][[:punct:]]'| grep http://www.google.com/url\?q=http | sed -e 's/http:\/\/www.google.com\/url?q=//g' |sed -e 's/&sa=.*$//g'|grep -v google | cut -c5- | sed -rn "=;p;"| sed -r "N;s/\n//" | sed -e "s/\<\([0-9]\{1,2\}\)\>/0000\1/; s/\<0*\([0-9]\{2\}\)\>/\1/" |sed -e "s/^/ /g"
else
query="$1";lynx -dump --display_charset=utf-8 "http://google.com/search?q=$(echo $query | sed 's/ /+/g')"|grep '^[[:blank:]][[:blank:]].[[:digit:]][[:punct:]]'| grep http://www.google.com/url\?q=http | sed -e 's/http:\/\/www.google.com\/url?q=//g' |sed -e 's/&sa=.*$//g'|grep -v google | cut -c5- | sed -rn "=;p;"| sed -r "N;s/\n//" | sed -e "s/\<\([0-9]\{1,2\}\)\>/0000\1/; s/\<0*\([0-9]\{2\}\)\>/\1/" |sed -e "s/^/ /g"
fi
@dewomser
Copy link
Author

Bash script. Search in Google from commandline . Needs lynx
Screenshot_20230715_185357

@dewomser
Copy link
Author

Mit https und cookiehandling Äh… So ähnlich… Das ist nicht fertig !

query="lolo";lynx -dump -cookies -accept_all_cookies --display_charset=utf-8 "https://google.com/search?q=$(echo $query | sed 's/ /+/g')"|grep '^:blank::blank:.:digit::punct:'| grep https://www.google.com/url\?q=https | sed -e 's/https://www.google.com/url?q=//g' |sed -e 's/&sa=.$g'|grep -v google | cut -c5- | sed -rn "=;p;"| sed -r "N;s/\n" | sed -e "s/<([0-9]{1,2})>/0000\1/; s/<0([0-9]{2})>/\1/" |sed -e "s/^/ /g"| sed -e "s/./;/1" > lolo.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment