A CLI tool that scrapes Google search results and SERPs that provides instant and concise answers
The script uses pup
to scrape Google search results and SERPs.
If the query returns several results, Tuxi will choose the most
relevant result on the basis of priority.
In addition to scraping, tuxi
also uses jq
, awk
and sed
to process and return results, and recode
to unescape html.
Watch this video for more info
Also checkout BugsWriter's YouTube channel for more scripts like this.
cURL tuxi to your $PATH and give execute permissions.
$ sudo curl -sL "https://raw.githubusercontent.com/Bugswriter/tuxi/main/tuxi" -o /usr/local/bin/tuxi
$ sudo chmod +x /usr/local/bin/tuxi
To update, just do
curl
again, no need tochmod
anymore.
To uninstall, simply removetuxi
from your $PATH, for examplesudo rm -f /usr/local/bin/tuxi
.
$ git clone https://github.com/Bugswriter/tuxi.git && cd tuxi/
$ sudo make install
To update, just
git pull
on your local tuxi repository and reinstall withsudo make install
.
To uninstall, simply runsudo make uninstall
.
Tuxi is available as the tuxi-git
package in the AUR.
$ yay -S tuxi-git
$ tuxi "Is Linux better than Windows?"
---
Linux has a reputation for being fast and smooth while
Windows 10 is known to become slow and slow over
time. Linux runs faster than Windows 8.1 and Windows 10
along with a modern desktop environment and qualities of the
operating system while windows are slow on older hardware.
---
tuxi linus torvalds birthday
.tuxi
.Use -h
to display the help message.
Usage: tuxi [options] query
OR: query source | tuxi [options]
Options:
-h Show this help message and exit.
-v Print tuxi version info and exit.
-r Raw search results.
(no pretty output, no colors)
-q Only output search results.
(silences "Did you mean?", greeting, usage)
-a Prints all valid answers.
-u Prints out the top handful of URLs for your search query
(this is automatically printed out if tuxi can't find you an answer)
-b Tries to select the best answer based on keywords at the start and end of your query.
(experimental - eg: define WORD, SONG lyrics, PERSON quotes, weather CITY, FILM cast)
-t Pick answers to test.
(you can specify multiple answers using tuxi_NAME in your query)
-l use LANG_[lang] in your query to override the language used
(eg: tuxi -l LANG_en_US my search query)
tuxi supports the following environment variables:
TUXI_LANG=[lang] sets default search language (eg: TUXI_LANG='en_US')
TUXI_DELAY=[int] if you find more than one answer is being printed (and you're not using -a)
increase this number by a little (you want it to be as low as possible)
default value is 250 (eg: TUXI_DELAY=270)
developer flags:
-d prints debug info along with results
-s saves HTML for this query to /home/dave/.cache/tuxi/[date]-[query].html
-c use most recent cached result and query
this can be combined with -t flag to more quickly test for different answers
-p disable pipe support (it can break some scripts including our own test script)
Report bugs at https://github.com/Bugswriter/tuxi/issues
Easily change query language
Line 8 in tuxi
contains the language variable which can be changed according the user's preference. However, tuxi will use the system default langauge if none is set.
Gives corrections
$ tuxi linux torvalds birthday
> Did you mean linus?
---
28 December 1969
---
When you know it's actually linux torvalds -q option
$ tuxi -q linux torvalds birthday
---
28 December 1969
---
Raw formatting for output (no colors) -r option
Useful for e.g scripting
notify-send
.$ tuxi -r linux torvalds birthday Did you mean linus? 28 December 1969
Math operations
$ tuxi "log(30)"
---
1.4771212547196624
---
Translate
$ tuxi "I love you in japanese"
---
わたしは、あなたを愛しています
---
$ tuxi "わたしは、あなたを愛しています in english"
---
I love you
---
And much more (lyrics, weather, conversions...)
This project is licensed under GPL-3.0.
If you want to contribute, please see CONTRIBUTING.