sweb

Some web helper scripts.
git clone git://r-36.net/sweb
Log | Files | Refs | LICENSE

seeks (514B)


      1 #!/bin/sh
      2 # See the LICENSE file for copyright and license details.
      3 
      4 # TODO: Mirror select if they have more stable servers.
      5 HOST="http://seeks.hydraze.org/search"
      6 
      7 if [ $# -lt 1 ];
      8 then
      9 	echo "usage: `basename $0` search terms ..."
     10 	exit 1
     11 fi
     12 
     13 search=`echo -n "$*" \
     14 	| perl -p -e 's/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg'`
     15 uri="${HOST}?q=${search}&expansion=1&action=expand"
     16 
     17 curl -s "$uri" \
     18 	| xpath -a href \
     19 		'//li[@class="search_snippet"]/div/a[@class="search_cite"]' \
     20 	| grep "^.*://" \
     21 	| uniq
     22