Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<h1 align="center">TUXI</h1>
<p align="center">A CLI tool that scrapes Google search results and SERPs that provides instant and concise answers</p>

##
##

<img src="https://i.ibb.co/sCwYpZ8/general.gif" alt="Video Preview Gif" align="right" width="500px"/>

### How does this work?

The script uses `pup` to scrape Google search results and SERPs.
If the query returns several results, Tuxi will choose the most
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`
In addition to scraping, `tuxi` also uses `jq`, `awk` and `sed`
to process and return results, and `recode` to unescape html.


Expand All @@ -33,15 +33,15 @@ 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 to `chmod` anymore.
> To update, just do `curl` again, no need to `chmod` anymore.
> To uninstall, simply remove `tuxi` from your **$PATH**, for example `sudo rm -f /usr/local/bin/tuxi`.

### Make
```sh
$ 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 with `sudo make install`.
> To update, just `git pull` on your local tuxi repository and reinstall with `sudo make install`.
> To uninstall, simply run `sudo make uninstall`.

### Arch Linux AUR
Expand Down Expand Up @@ -85,7 +85,7 @@ Report bugs at https://github.com/Bugswriter/tuxi/issues.

## Features

**Easily change query language**
**Easily change query language**
Line [8](./tuxi#L8) 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**
Expand Down
14 changes: 7 additions & 7 deletions tuxi
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ raw=false
quiet=false

# search result output format (changes if raw=true)
output() {
output() {
printf "%b---%b\n%s\n%b---%b\n" "$G" "$N" "$*" "$G" "$N"
}

Expand All @@ -98,10 +98,10 @@ while getopts "hrq" OPT; do
help_text
exit 0
;;
r)
r)
raw=true
;;
q)
q)
quiet=true
;;
*)
Expand All @@ -121,7 +121,7 @@ shift $((OPTIND-1))
if $raw; then
N=""; R=""; G=""; Y=""; M=""; C="";

output () {
output () {
printf "%s\n" "$*"
}
fi
Expand All @@ -136,11 +136,11 @@ fi
if [ -z "$1" ]; then
if [ $quiet = "false" ]; then
printf "Hi, I'm Tuxi. Ask me anything!\n"
help_text | head -n 1
help_text | head -n 1
fi
exit 0
fi

# Else, all arguments are saved in $query
query="$*"

Expand All @@ -152,7 +152,7 @@ query="$*"
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0"
google_url="https://www.google.com/search?hl="${LANGUAGE:="${LANG:=en_US}"}""

# Response from Google via cURL (-G: get, -s: silent)
# Response from Google via cURL (-G: get, -s: silent)
google_html=$(curl -Gs --compressed "$google_url" --user-agent "$user_agent" --data-urlencode "q=$query")


Expand Down
6 changes: 3 additions & 3 deletions tuxiqualitytest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ run=""

while getopts "r" o; do
case "${o}" in
r)
r)
raw=true
;;
*)
Expand All @@ -20,7 +20,7 @@ done
#this took to long for me to figure out

if $raw; then
red=""
red=""
run="-r"
fi

Expand Down Expand Up @@ -90,7 +90,7 @@ printf "Testing Translate¬\n" && ./tuxi $run "Vais para cascais? em ingles" 1>>
printf "Testing Translate¬\n" && ./tuxi $run "برمجة in english" 1>>testoutputs.txt && printf "\tpassed.\n" || printf "\tFailed...\n"
printf "Testing Translate¬\n" && ./tuxi $run "mañana in english?" 1>>testoutputs.txt && printf "\tpassed.\n" || printf "\tFailed...\n"
printf "Testing Translate¬\n" && ./tuxi $run "what is mananeo in english" 1>>testoutputs.txt && printf "\tpassed.\n" || printf "\tFailed...\n"
#it looks like you can only convert to english without error
#it looks like you can only convert to english without error


printf "Testing Weather¬\n" && ./tuxi $run "weather new york" 1>>testoutputs.txt && printf "\tpassed.\n" || printf "\tFailed...\n"
Expand Down