zeptobar-of-week - annna - Annna the nice friendly bot.
(HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
zeptobar-of-week (811B)
---
1 #!/bin/sh
2
3 export PATH="/home/annna/bin:$PATH"
4
5 channel=#bitreich-books
6
7 zeptobar="$(curl -s https://zeptobars.com/en/rss | sfeed | awk -F '\t' '{
8 SKIP["DATA-LOGO"]++
9 SKIP["^$"]++
10 IMGRE = "(https:)?//[a-z.0-9.A-Z]+/[-.A-Z.a-z.0-9._]+.(jpg|png|jpeg)"
11
12 url = $3
13 buf = $4
14
15 n = 0
16 while (match(buf, IMGRE)) {
17 new = substr(buf, RSTART, RLENGTH)
18 if (new ~ "^//")
19 new = "https:" new
20
21 skip = 0
22 for (x in SKIP)
23 skip += (new ~ x)
24 if (skip == 0) {
25 urls[n++] = new
26 hash[new]++
27 }
28
29 buf = substr(buf, RSTART + RLENGTH)
30 }
31
32 printf "%s", url
33
34 for (i = 0; i < n; i++) {
35 hd = urls[i]
36 sub(/\.(jpg|jpeg|png)$/, "-HD&", hd)
37 if (hash[hd])
38 continue
39
40 printf " - %s", urls[i]
41 }
42 printf "\n"
43
44 delete urls
45 }' | sort -R | sed q)"
46
47 annna-say -c "${channel}" "This week's Zeptobar: ${zeptobar}"