ws (663B)
1 #!/bin/sh 2 3 # Firefox ESR so we don't have to chase latest version often 4 firefox="Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0" 5 6 prog=' 7 /duckduckgo.com\/y.js/ { next } # skip ads 8 /Sponsored link/ { next } # skip ads 9 /result-link/ { 10 $1=$1 11 link = substr($3, index($3, "\""), length($3)) 12 link = substr(link, 2, length(link)-2) 13 14 title = substr($0, index($0, ">")+1, length) 15 title = substr(title, 1, index(title, "<")-1) 16 print link 17 print "\t" title 18 } 19 ' 20 21 usage="usage: $0 query ..." 22 if test $# -eq 0 23 then 24 echo $usage 25 exit 1 26 fi 27 28 curl -s --compressed --data-urlencode "q=$*" -A "$firefox" https://lite.duckduckgo.com/lite/ | awk "$prog"