URI: 
       Make imdb2gopherbay more informative. Thanks Bob! - 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 8a548fd708b38b336d9bb7fdd7571a7f43c6cfec
   DIR parent d8b532623d9a3738e1d67f668c1953add6a2315b
  HTML Author: Annna Robert-Houdin <annna@bitreich.org>
       Date:   Mon, 29 Aug 2022 21:05:21 +0200
       
       Make imdb2gopherbay more informative. Thanks Bob!
       
       Diffstat:
         M annna-message-common                |       7 ++++---
         M imdb2gopherbay                      |      68 ++++++++++++++++---------------
       
       2 files changed, 40 insertions(+), 35 deletions(-)
       ---
   DIR diff --git a/annna-message-common b/annna-message-common
       @@ -116,10 +116,11 @@ case "${text}" in
                        nuris="$(xkcd-uri "${uri}")"
                        ;;
                *imdb.com/title/*)
       -                movietitle="$(imdb2gopherbay "${uri}" | sed 's, ,+,g')"
       -                if [ -n "${movietitle}" ];
       +                imdbstr="$(imdb2gopherbay "${uri}")"
       +                if [ -n "${imdbstr}" ];
                        then
       -                        nuris="gopher://bay.parazy.de:666/1/q.dcgi?${movietitle}"
       +                        nuris="${imdbstr}"
       +                        urititle=""
                        fi
                        ;;
                *themoviedb.org/movie/*)
   DIR diff --git a/imdb2gopherbay b/imdb2gopherbay
       @@ -8,47 +8,51 @@ then
                exit 1
        fi
        
       -# TODO: See, if this is needed eventually, if title changes.
       -extractjson() {
       -awk '
       -/<script id="__NEXT_DATA__"/ {
       -        match($0, "<script id=\"__NEXT_DATA__\"[^>]*>");
       -        s = substr($0, RSTART + RLENGTH);OB
       -        match(s, "</script>");
       -        s = substr(s, 1, RSTART - 1);
       -        print s;
       -}'
       -}
       -
        imdburi="$1"
       -title="$(curl -H 'Accept-Language: en' -s "${imdburi}" \
       -        | grabtitle \
       -        | sed 's, - IMDb,,')"
       +
       +# Josuah Ver0:
       +#extractjson() {
       +#awk '
       +#/<script id="__NEXT_DATA__"/ {
       +#        match($0, "<script id=\"__NEXT_DATA__\"[^>]*>");
       +#        s = substr($0, RSTART + RLENGTH);OB
       +#        match(s, "</script>");
       +#        s = substr(s, 1, RSTART - 1);
       +#        print s;
       +#}'
       +#}
       +
       +# Raw Ver1:
       +#title="$(curl -H 'Accept-Language: en' -s "${imdburi}" \
       +#        | grabtitle \
       +#        | sed 's, - IMDb,,')"
        
        # Ver1:
       +#title="$(curl -H 'Accept-Language: en' -s "${imdburi}" \
        #        | extractjson \
        #        | json2tsv \
        #        | grep associatedTitle.originalTitleText.text )"
        #        | head -n 1 \
        #        | cut -f 3)"
       -#
       -# Evil_Bob Ver2: Thanks!
       -#| extractjson | sed 1q | json2tsv | LC_ALL=C awk '
       -#BEGIN {
       -#        FS = OFS = "\t";
       -#}
       -#$1 == ".@type" { type = $3; }
       -#$1 == ".description" { description = $3; }
       -#$1 == ".name" { name = $3; }
       -#$1 == ".aggregateRating.ratingValue" { rating = $3; }
       -#$1 == ".datePublished" { published = substr($3, 1, 4); }
       -#END {
       -#        printf("%s (%s) from %s, rating: %s: %s\n",
       -#                name, type, published, rating, description);
       -#}'
        
       -[ -z "${title}" ] && exit 1
       +#[ -z "${title}" ] && exit 1
       +#
       +#printf "%s\n" "${title}"
        
       -printf "%s\n" "${title}"
       +# Evil_Bob Ver2: Thanks!
       +curl -H 'Accept-Language: en' -s "${imdburi}" \
       +| extractjson | sed 1q | json2tsv | LC_ALL=C awk '
       +BEGIN {
       +        FS = OFS = "\t";
       +}
       +$1 == ".@type" { type = $3; }
       +$1 == ".description" { description = $3; }
       +$1 == ".name" { name = $3; uriname = gensub(" ", "+", "g", $3); }
       +$1 == ".aggregateRating.ratingValue" { rating = $3; }
       +$1 == ".datePublished" { published = substr($3, 1, 4); }
       +END {
       +        printf("gopher://bay.parazy.de:666/1/q.dcgi?%s | %s (%s) from %s, rating: %s: %s\n",
       +                uriname, name, type, published, rating, description);
       +}'