Change comments links to teddit, replace Yandex with Alamy

This commit is contained in:
Victor 2023-06-11 14:06:18 +03:00
parent c781a4edac
commit 8b3b20210d

View File

@ -12,6 +12,7 @@ media = stream(subreddits)
.filter(def(p) = reduce([".jpg", ".png"], false, def(acc, ext) = acc || indexOf(p.url, ext) > 0))
.filter(::isPostUnique)
//.peek(def(p) = bot.sendPhoto(config.peer, p.url))
.limit(10)
.peek(::addPost)
.map(def(p) = {
"type": "photo",
@ -19,7 +20,6 @@ media = stream(subreddits)
"caption": getCaption(p),
"parse_mode": "html"
})
.limit(10)
.toArray()
debug(jsonencode(media))
@ -52,9 +52,9 @@ def getCaption(post) {
}
return sprintf(
"<a href=\"%s\">%s</a>\n" +
"<a href=\"https://reddit.com%s\">🗨 Comments</a>%s\n" +
"<a href=\"https://teddit.zaggy.nl%s\">🗨 Comments</a>%s\n" +
"🔎 <a href=\"https://saucenao.com/search.php?url=%s\">SauceNAO</a>, " +
"<a href=\"https://yandex.ua/images/search?rpt=imageview&url=%s\">Yandex</a>",
"<a href=\"https://www.alamy.com/search.html?imageurl=%s\">Alamy</a>",
safe(post.url), safe(post.title),
safe(post.permalink), tag,
urlencode(post.url),