Skip to content

Commit

Permalink
[sankaku] detect expired links (#2958)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Sep 23, 2022
1 parent 09a5cc6 commit 8506085
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gallery_dl/extractor/sankaku.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8506085

Please sign in to comment.