Last active
January 20, 2026 19:12
-
-
Save dewomser/aa12dff5724d12fa1e24b94251e785fe to your computer and use it in GitHub Desktop.
Funktioniert nicht mehr, weil Google den lynx-Browser nicht mehr unterstützt.
This file contains hidden or 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 | |
| # $(which 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' | |
| #Google mit http (funktiniert ohne cookies) | |
| ggf () { 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" ; } | |
| #Google mit https | |
| ggs () { lynx -dump -cookies -accept_all_cookies --display_charset=utf-8 "https://google.com/search?q=$(echo "$query" | tr ' ' '+')" | grep '^[[:blank:]][[:blank:]].[[:digit:]][[:punct:]]' | grep https://www.google.com/url\?q=http | 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" ; } | |
| gg="ggf" | |
| uber="$1" | |
| if [[ "$1" == "-s" ]] ; then | |
| gg="ggs" | |
| uber="$2" | |
| fi | |
| if [[ "$1" == "-h" ]] ; then | |
| echo -e "-h Diese Hilfe | |
| -s fragt über https (default ist http) | |
| ohne Parameter fragt das Skript. | |
| Parameter ohne Minuszeichen werden als Frage interpretiert. Satz als Frage muss gequotet sein" | |
| elif [[ -z "$uber" ]] ; then | |
| read -rp"Suche: " query ; "$gg" | |
| else | |
| query="$uber"; "$gg" | |
| fi |
This file contains hidden or 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 | |
| # Abfrage htttp ohne Cookies.Kann auch als 1-Zeiler benutzt werden. | |
| read -p "Google-Suche: " query | |
| lynx -dump "http://google.com/search?q=${query// /+}" | | |
| while IFS= read -r line; do | |
| [[ $line =~ ^[[:blank:]][[:blank:]].[[:digit:]][[:punct:]] && $line =~ http://www.google.com/url?q=http ]] && | |
| url="${BASH_REMATCH[0]}" && | |
| url="${url//http:\/\/www.google.com\/url?q=}" && | |
| url="${url%%&sa=*}" && | |
| [[ $url != *google* ]] && | |
| echo "$url" | |
| done |
Author
Author
Hilfeseite
Googlesuche funktioniert jetzt mit "https"
-h Hilfe
-s Abfrage über https (default ist http)
Beispiel: google-search .sh-s "was soll das"
Beispiel: google-searcg.sh "was soll das "
Beispiel: google-search.sh -s
Beispiel: google-search.sh
Beispiel: google-search.sh -h
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bash script. Search in Google from commandline . Needs lynx
