#!/bin/sh
#list of instances from
gopher://triapul.cz/files/underside/
#built for (cuban) links
#triapul.cz 2024
#put your browser here
BROWSER=links
help() {
cat <<eof_
slik, s(earxng with)li(n)k(s) in ksh
slik is a program that is intended to be run
from the commandline, evoking the defined browser
and querying a random public searxng search engine
instance.
usage:
slik [-ivtnT] [-h] "<query>"
options:
-i search images
-I search it
-v search videos
-m search music
-M search maps
-n search news
-t search torrents
eof_
}
SEARCH_SWITCH=general
while getopts :iImMvtThn FLAG; do
case $FLAG in
i) SEARCH_SWITCH=images;shift;;
I) SEARCH_SWITCH=it;shift;;
v) SEARCH_SWITCH=videos;shift;;
m) SEARCH_SWITCH=music;shift;;
M) SEARCH_SWITCH=map;shift;;
n) SEARCH_SWITCH=videos;shift;;
t) SEARCH_SWITCH=files;shift;;
s) SEARCH_SWITCH=science;shift;;
h) help; exit;;
esac
done
instance_sel() {
echo "/files/underside/searxng.txt" | nc triapul.cz 70 | sort -R | head -n1 | cut -d'/' -f3
}
QUERY="$*"
QUERY=$(echo $QUERY | sed 's/ /+/g')
append="/search?q=$QUERY&language=all&time_range=&safesearch=0&categories=$SEARCH_SWITCH"
$BROWSER "https://$(instance_sel)$append"