oneliner - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- oneliner (531B) --- 1 #!/bin/sh 2 3 tsvoutput=0 4 [ "$1" = "-t" ] && tsvoutput=1 5 6 curl -s https://ascii.co.uk/oneline \ 7 | grep '/oneline/' \ 8 | sed 's,.*href="\(/oneline/[^ "]*\)".*,https://ascii.co.uk\1,' \ 9 | shuf -n 1 \ 10 | while read -r uri; 11 do 12 oneliner="$(curl -s "${uri}" \ 13 | grep '</span></pre></font></div>' \ 14 | sed 's,</span></pre></font></div>,,')" 15 if [ -z "${oneliner}" ]; 16 then 17 exit 1 18 else 19 if [ $tsvoutput -gt 0 ]; 20 then 21 printf "%s\t%s\n" "${oneliner}" "${uri}" 22 else 23 printf "%s ( %s )\n" "${oneliner}" "${uri}" 24 fi 25 fi 26 done 27