From 850608551c2cbd77394f0e55c1002eac82225d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 23 Sep 2022 11:51:30 +0200 Subject: [PATCH] [sankaku] detect expired links (#2958) --- gallery_dl/extractor/sankaku.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/sankaku.py b/gallery_dl/extractor/sankaku.py index 2ce7f6ca56..34fa0e353d 100644 --- a/gallery_dl/extractor/sankaku.py +++ b/gallery_dl/extractor/sankaku.py @@ -53,12 +53,15 @@ def _file_url(self, post): url = "https://s.sankakucomplex.com" + url[url.index("/", 8):] return url - @staticmethod - def _prepare(post): + def _prepare(self, post): post["created_at"] = post["created_at"]["s"] post["date"] = text.parse_timestamp(post["created_at"]) post["tags"] = [tag["name"] for tag in post["tags"] if tag["name"]] post["tag_string"] = " ".join(post["tags"]) + post["_http_validate"] = self._check_expired + + def _check_expired(self, response): + return not response.history or '.com/expired.png' not in response.url def _extended_tags(self, post): tags = collections.defaultdict(list)