Add imdb2gopherbay support. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 13d409722b343bec7ebea91ddeff211f13e62883 | |
parent a2e909bbbbb641ad541bc48789606c3d25e1ac87 | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Sat, 14 Aug 2021 15:18:51 +0200 | |
Add imdb2gopherbay support. | |
Diffstat: | |
M annna-message-common | 7 +++++++ | |
A imdb2gopherbay | 21 +++++++++++++++++++++ | |
2 files changed, 28 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/annna-message-common b/annna-message-common | |
@@ -88,6 +88,13 @@ case "${text}" in | |
nuris="" | |
fi | |
;; | |
+ *imdb.com/title/*) | |
+ movietitle="$(imdb2gopherbay "${uri}")" | |
+ if [ -n "${movietitle}" ]; | |
+ then | |
+ nuris="gopher://bay.parazy.de:666/1/q.dcgi?${m… | |
+ fi | |
+ ;; | |
*lichess.org/????????|*lichess.org/????????/|*lichess.org/????… | |
nuris="$(printf "%s\n" "${uri}" \ | |
| sed 's,https://lichess.org\(/[^ ]*\)$,\1,; s… | |
diff --git a/imdb2gopherbay b/imdb2gopherbay | |
@@ -0,0 +1,21 @@ | |
+#!/bin/sh | |
+ | |
+if [ $# -lt 1 ]; | |
+then | |
+ printf "usage: %s imdburi\n" "$(basename "$0")" >&2 | |
+ exit 1 | |
+fi | |
+ | |
+imdburi="$1" | |
+title="$(curl -s "${imdburi}" \ | |
+ | xml2tsv 2>/dev/null \ | |
+ | grep __NEXT_ \ | |
+ | cut -f 4- \ | |
+ | sed 's,\\\\,\\,g' \ | |
+ | jshon -e head -e 9 -e 1 -e children -u \ | |
+ | sed 's, - IMDb,,')" | |
+ | |
+[ -z "${title}" ] && exit 1 | |
+ | |
+printf "%s\n" "${title}" | |
+ |