From a57451800408edd508eb58cb6276ad46737ea076 Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 8 Sep 2019 10:47:31 -0400 Subject: [PATCH] add syn-ch --- chan.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/chan.py b/chan.py index b58f574..67f381e 100644 --- a/chan.py +++ b/chan.py @@ -235,7 +235,22 @@ class AlokalJsonChanHelper(JsonChanHelper): elif "sub" in item and item["sub"]: urls.update(get_links_from_body(item["sub"])) if "fsize" in item and item["fsize"]: - urls.add(self._base_url + self._image_path + item["tim"] + "/" + str(item["no"]) + item["ext"]) + urls.add(self._image_url + self._image_path + item["tim"] + "/" + str(item["no"]) + item["ext"]) + + return list(urls) + + +class SynchJsonChanHelper(JsonChanHelper): + + def item_urls(self, item, board): + urls = set() + + if "com" in item and item["com"]: + urls.update(get_links_from_body(item["com"])) + elif "sub" in item and item["sub"]: + urls.update(get_links_from_body(item["sub"])) + if "fsize" in item and item["fsize"]: + urls.add(self._image_url + self._image_path + item["tim"] + item["ext"]) return list(urls) @@ -394,5 +409,17 @@ CHANS = { "jp", "drive" ), rps=1 / 60 + ), + "synch": SynchJsonChanHelper( + 12, + "https://syn-ch.ru/", + "https://cdn.syn-ch.ru/", + "/res/", + "src", + ( + "b", "d", "_r", "a", "_g", "mlp", "mu", "_tv", "vg", + "_wh", "old", "test" + ), + rps=1 / 120 ) }