Introduction
Introduction Statistics Contact Development Disclaimer Help
imdb2gopherbay - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
imdb2gopherbay (1413B)
---
1 #!/bin/sh
2
3 export PATH="/home/annna/bin:$PATH"
4
5 if [ $# -lt 1 ];
6 then
7 printf "usage: %s imdburi\n" "$(basename "$0")" >&2
8 exit 1
9 fi
10
11 imdburi="$1"
12
13 # Josuah Ver0:
14 #extractjson() {
15 #awk '
16 #/<script id="__NEXT_DATA__"/ {
17 # match($0, "<script id=\"__NEXT_DATA__\"[^>]*>");
18 # s = substr($0, RSTART + RLENGTH);OB
19 # match(s, "</script>");
20 # s = substr(s, 1, RSTART - 1);
21 # print s;
22 #}'
23 #}
24
25 # Raw Ver1:
26 #title="$(curl -H 'Accept-Language: en' -s "${imdburi}" \
27 # | grabtitle \
28 # | sed 's, - IMDb,,')"
29
30 # Ver1:
31 #title="$(curl -H 'Accept-Language: en' -s "${imdburi}" \
32 # | extractjson \
33 # | json2tsv \
34 # | grep associatedTitle.originalTitleText.text )"
35 # | head -n 1 \
36 # | cut -f 3)"
37
38 #[ -z "${title}" ] && exit 1
39 #
40 #printf "%s\n" "${title}"
41
42 # Evil_Bob Ver2: Thanks!
43 curl -H 'Accept-Language: en' \
44 -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/…
45 -s "${imdburi}" \
46 | extractjson | sed 1q | json2tsv | LC_ALL=C awk '
47 BEGIN {
48 FS = OFS = "\t";
49 }
50 $1 == ".@type" { type = $3; }
51 $1 == ".description" { description = $3; }
52 $1 == ".name" { name = $3; uriname = gensub(" ", "+", "g", $3); }
53 $1 == ".aggregateRating.ratingValue" { rating = $3; }
54 $1 == ".datePublished" { published = substr($3, 1, 4); }
55 END {
56 printf("gopher://bay.parazy.de:666/1/q.dcgi?%s | %s (%s) from %s…
57 uriname, name, type, published, rating, description);
58 }'
59
60
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.