URI: 
       Add video search. - 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
       ---
   DIR commit a7332eca163bb6338851912e77c7ca07356755a1
   DIR parent 387b4a7807cbb388e7eeb528f7e48e1680a87838
  HTML Author: Annna Robert-Houdin <annna@bitreich.org>
       Date:   Wed, 17 Apr 2024 16:30:52 +0200
       
       Add video search.
       
       Thanks eidolon for the recommendation!
       
       Diffstat:
         M annna-message-common                |      15 +++++++++++++++
         A idiotbox-roulette                   |      20 ++++++++++++++++++++
       
       2 files changed, 35 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/annna-message-common b/annna-message-common
       @@ -320,6 +320,21 @@ case "${text}" in
                        annna-say -s "${server}" -c "${channel}" "${user}, your type is ${usertype}"
                }
                ;;
       +"${ircuser}, please give me a video about "*)
       +        word="$(printf "%s\n" "${text}" | cut -c 38-)"
       +        case "$word" in
       +        *\?)
       +                word="$(printf "%s\n" "${word}" | cut -c -"$((${#word} - 1))")"
       +                ;;
       +        esac
       +        videoresult="$(idiotbox-roulette "${word}")"
       +        if [ -n "${videoresult}" ];
       +        then
       +                annna-say -s "${server}" -c "${channel}" "${user}, ${videoresult}"
       +        else
       +                annna-say -s "${server}" -c "${channel}" "${user}, sorry, nothing founds."
       +        fi
       +        ;;
        "${ircuser}, what is "*)
                word="$(printf "%s\n" "${text}" | cut -c 16-)"
                case "$word" in
   DIR diff --git a/idiotbox-roulette b/idiotbox-roulette
       @@ -0,0 +1,20 @@
       +#!/bin/sh
       +# idiotbox roulette
       +# by: eidolon
       +# Thanks!
       +
       +[ -z "$1" ] && exit 1
       +
       +printf '/idiotbox.cgi\t%s\r\n' "$1" |
       +  nc codemadness.org 70 |
       +  awk -v seed="$RANDOM" '
       +    BEGIN { FS="\t"; srand(seed) }
       +
       +    /^h/ && !/^hAtom/ { out[i++] = $1" "$2 }
       +
       +    END {
       +      p = out[int(rand()*length(out))]
       +      p = substr(p, 2)
       +      print p
       +    }
       +  ' | sed 's,URL:,url: ,'