diff options
Diffstat (limited to 'gallery_dl/extractor/sankaku.py')
| -rw-r--r-- | gallery_dl/extractor/sankaku.py | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/gallery_dl/extractor/sankaku.py b/gallery_dl/extractor/sankaku.py index ea4cf43..f36051b 100644 --- a/gallery_dl/extractor/sankaku.py +++ b/gallery_dl/extractor/sankaku.py @@ -13,6 +13,7 @@ from .common import Message from .. import text, util, exception from ..cache import cache import collections +import re BASE_PATTERN = r"(?:https?://)?" \ r"(?:(?:chan|beta|black|white)\.sankakucomplex\.com|sankaku\.app)" \ @@ -101,6 +102,11 @@ class SankakuTagExtractor(SankakuExtractor): # match arbitrary query parameters ("https://chan.sankakucomplex.com" "/?tags=marie_rose&page=98&next=3874906&commit=Search"), + # 'date:' tags (#1790) + ("https://chan.sankakucomplex.com/?tags=date:2023-03-20", { + "range": "1", + "count": 1, + }), ) def __init__(self, match): @@ -108,6 +114,15 @@ class SankakuTagExtractor(SankakuExtractor): query = text.parse_query(match.group(1)) self.tags = text.unquote(query.get("tags", "").replace("+", " ")) + if "date:" in self.tags: + # rewrite 'date:' tags (#1790) + self.tags = re.sub( + r"date:(\d\d)[.-](\d\d)[.-](\d\d\d\d)", + r"date:\3.\2.\1", self.tags) + self.tags = re.sub( + r"date:(\d\d\d\d)[.-](\d\d)[.-](\d\d)", + r"date:\1.\2.\3", self.tags) + def metadata(self): return {"search_tags": self.tags} @@ -153,7 +168,7 @@ class SankakuPostExtractor(SankakuExtractor): """Extractor for single posts from sankaku.app""" subcategory = "post" archive_fmt = "{id}" - pattern = BASE_PATTERN + r"/post/show/(\d+)" + pattern = BASE_PATTERN + r"/post/show/([0-9a-f]+)" test = ( ("https://sankaku.app/post/show/360451", { "content": "5e255713cbf0a8e0801dc423563c34d896bb9229", @@ -181,6 +196,17 @@ class SankakuPostExtractor(SankakuExtractor): "tags_general": ["key(mangaka)", "key(mangaka)"], }, }), + # md5 hexdigest instead of ID (#3952) + (("https://chan.sankakucomplex.com/post/show" + "/f8ba89043078f0e4be2d9c46550b840a"), { + "pattern": r"https://s\.sankakucomplex\.com" + r"/data/f8/ba/f8ba89043078f0e4be2d9c46550b840a\.jpg", + "count": 1, + "keyword": { + "id": 33195194, + "md5": "f8ba89043078f0e4be2d9c46550b840a", + }, + }), ("https://chan.sankakucomplex.com/post/show/360451"), ("https://chan.sankakucomplex.com/ja/post/show/360451"), ("https://beta.sankakucomplex.com/post/show/360451"), @@ -248,7 +274,7 @@ class SankakuAPI(): "lang" : "en", "page" : "1", "limit": "1", - "tags" : "id_range:" + post_id, + "tags" : ("md5:" if len(post_id) == 32 else "id_range:") + post_id, } return self._call("/posts", params) |
