zeptobar-of-week: every week a microcontroller die - 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 488d75e24202f1ce8b3ad33cc7f0e5b670265ad9 DIR parent a9591c94d12d01c919fa1c12be01b37dd1a87c38 HTML Author: Josuah Demangeon <me@josuah.net> Date: Wed, 1 Dec 2021 16:47:53 +0100 zeptobar-of-week: every week a microcontroller die Signed-off-by: Annna Robert-Houdin <annna@bitreich.org> Diffstat: A zeptobar-of-week | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+), 0 deletions(-) --- DIR diff --git a/zeptobar-of-week b/zeptobar-of-week @@ -0,0 +1,45 @@ +#!/bin/sh -e + +channel=#bitreich-books + +zeptobar="$(curl -s https://zeptobars.com/en/rss | sfeed | awk -F '\t' '{ + SKIP["DATA-LOGO"]++ + SKIP["^$"]++ + IMGRE = "(https:)?//[a-z.0-9.A-Z]+/[-.A-Z.a-z.0-9._]+.(jpg|png|jpeg)" + + url = $3 + buf = $4 + + n = 0 + while (match(buf, IMGRE)) { + new = substr(buf, RSTART, RLENGTH) + if (new ~ "^//") + new = "https:" new + + skip = 0 + for (x in SKIP) + skip += (new ~ x) + if (skip == 0) { + urls[n++] = new + hash[new]++ + } + + buf = substr(buf, RSTART + RLENGTH) + } + + printf "%s", url + + for (i = 0; i < n; i++) { + hd = urls[i] + sub(/\.(jpg|jpeg|png)$/, "-HD&", hd) + if (hash[hd]) + continue + + printf " - %s", urls[i] + } + printf "\n" + + delete urls +}' | sort -R | sed q)" + +annna-say -c "${channel}" "This week's Zeptobar: ${zeptobar}"