diff options
Diffstat (limited to 'gallery_dl/extractor/kemonoparty.py')
| -rw-r--r-- | gallery_dl/extractor/kemonoparty.py | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/gallery_dl/extractor/kemonoparty.py b/gallery_dl/extractor/kemonoparty.py index 6483278..f1d7bcf 100644 --- a/gallery_dl/extractor/kemonoparty.py +++ b/gallery_dl/extractor/kemonoparty.py @@ -14,7 +14,7 @@ from ..cache import cache import itertools import re -BASE_PATTERN = r"(?:https?://)?(?:www\.)?kemono\.party" +BASE_PATTERN = r"(?:https?://)?(?:www\.)?(kemono|coomer)\.party" USER_PATTERN = BASE_PATTERN + r"/([^/?#]+)/user/([^/?#]+)" @@ -27,17 +27,30 @@ class KemonopartyExtractor(Extractor): archive_fmt = "{service}_{user}_{id}_{num}" cookiedomain = ".kemono.party" + def __init__(self, match): + if match.group(1) == "coomer": + self.category = "coomerparty" + self.root = "https://coomer.party" + self.cookiedomain = ".coomer.party" + Extractor.__init__(self, match) + def items(self): self._prepare_ddosguard_cookies() self._find_inline = re.compile( - r'src="(?:https?://kemono\.party)?(/inline/[^"]+' + r'src="(?:https?://(?:kemono|coomer)\.party)?(/inline/[^"]+' r'|/[0-9a-f]{2}/[0-9a-f]{2}/[0-9a-f]{64}\.[^"]+)').findall find_hash = re.compile("/[0-9a-f]{2}/[0-9a-f]{2}/([0-9a-f]{64})").match generators = self._build_file_generators(self.config("files")) comments = self.config("comments") username = dms = None + # prevent files from coomer.party to be sent with gzip compression + if "coomer" in self.root: + headers = {"Accept-Encoding": "identity"} + else: + headers = None + if self.config("metadata"): username = text.unescape(text.extract( self.request(self.user_url).text, @@ -83,10 +96,11 @@ class KemonopartyExtractor(Extractor): post["type"] = file["type"] post["num"] += 1 + post["_http_headers"] = headers if url[0] == "/": url = self.root + "/data" + url - elif url.startswith("https://kemono.party"): + elif url.startswith(self.root): url = self.root + "/data" + url[20:] text.nameext_from_url(file["name"], post) @@ -129,7 +143,7 @@ class KemonopartyExtractor(Extractor): def _build_file_generators(self, filetypes): if filetypes is None: - return (self._file, self._attachments, self._inline) + return (self._attachments, self._file, self._inline) genmap = { "file" : self._file, "attachments": self._attachments, @@ -191,8 +205,9 @@ class KemonopartyUserExtractor(KemonopartyExtractor): ) def __init__(self, match): + _, service, user_id, offset = match.groups() + self.subcategory = service KemonopartyExtractor.__init__(self, match) - service, user_id, offset = match.groups() self.api_url = "{}/api/{}/user/{}".format(self.root, service, user_id) self.user_url = "{}/{}/user/{}".format(self.root, service, user_id) self.offset = text.parse_int(offset) @@ -233,7 +248,7 @@ class KemonopartyPostExtractor(KemonopartyExtractor): "published": "Sun, 11 Aug 2019 02:09:04 GMT", "service": "fanbox", "shared_file": False, - "subcategory": "post", + "subcategory": "fanbox", "title": "c96取り置き", "type": "file", "user": "6993449", @@ -249,7 +264,7 @@ class KemonopartyPostExtractor(KemonopartyExtractor): # kemono.party -> data.kemono.party ("https://kemono.party/gumroad/user/trylsc/post/IURjT", { "pattern": r"https://kemono\.party/data/(" - r"files/gumroad/trylsc/IURjT/reward8\.jpg|" + r"a4/7b/a47bfe938d8c1682eef06e885927484cd8df1b.+\.jpg|" r"c6/04/c6048f5067fd9dbfa7a8be565ac194efdfb6e4.+\.zip)", }), # username (#1548, #1652) @@ -272,13 +287,19 @@ class KemonopartyPostExtractor(KemonopartyExtractor): "date": "2021-07-31 02:47:51.327865", }]}, }), + # coomer.party (#2100) + ("https://coomer.party/onlyfans/user/alinity/post/125962203", { + "pattern": r"https://coomer\.party/data/7d/3f/7d3fd9804583dc224968" + r"c0591163ec91794552b04f00a6c2f42a15b68231d5a8\.jpg", + }), ("https://kemono.party/subscribestar/user/alcorart/post/184330"), ("https://www.kemono.party/subscribestar/user/alcorart/post/184330"), ) def __init__(self, match): + _, service, user_id, post_id = match.groups() + self.subcategory = service KemonopartyExtractor.__init__(self, match) - service, user_id, post_id = match.groups() self.api_url = "{}/api/{}/user/{}/post/{}".format( self.root, service, user_id, post_id) self.user_url = "{}/{}/user/{}".format(self.root, service, user_id) @@ -319,7 +340,7 @@ class KemonopartyDiscordExtractor(KemonopartyExtractor): def __init__(self, match): KemonopartyExtractor.__init__(self, match) - self.server, self.channel, self.channel_name = match.groups() + _, self.server, self.channel, self.channel_name = match.groups() def items(self): self._prepare_ddosguard_cookies() @@ -353,7 +374,7 @@ class KemonopartyDiscordExtractor(KemonopartyExtractor): url = file["path"] if url[0] == "/": url = self.root + "/data" + url - elif url.startswith("https://kemono.party"): + elif url.startswith(self.root): url = self.root + "/data" + url[20:] text.nameext_from_url(file["name"], post) @@ -392,7 +413,7 @@ class KemonopartyDiscordServerExtractor(KemonopartyExtractor): def __init__(self, match): KemonopartyExtractor.__init__(self, match) - self.server = match.group(1) + self.server = match.group(2) def items(self): url = "{}/api/discord/channels/lookup?q={}".format( |
