[sankaku] detect expired links (#2958)
This commit is contained in:
@@ -53,12 +53,15 @@ class SankakuExtractor(BooruExtractor):
|
|||||||
url = "https://s.sankakucomplex.com" + url[url.index("/", 8):]
|
url = "https://s.sankakucomplex.com" + url[url.index("/", 8):]
|
||||||
return url
|
return url
|
||||||
|
|
||||||
@staticmethod
|
def _prepare(self, post):
|
||||||
def _prepare(post):
|
|
||||||
post["created_at"] = post["created_at"]["s"]
|
post["created_at"] = post["created_at"]["s"]
|
||||||
post["date"] = text.parse_timestamp(post["created_at"])
|
post["date"] = text.parse_timestamp(post["created_at"])
|
||||||
post["tags"] = [tag["name"] for tag in post["tags"] if tag["name"]]
|
post["tags"] = [tag["name"] for tag in post["tags"] if tag["name"]]
|
||||||
post["tag_string"] = " ".join(post["tags"])
|
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):
|
def _extended_tags(self, post):
|
||||||
tags = collections.defaultdict(list)
|
tags = collections.defaultdict(list)
|
||||||
|
|||||||
Reference in New Issue
Block a user