From 486474800fd56c941082815886f1eec42ab29fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 23 Jul 2021 16:38:57 +0200 Subject: [PATCH] [kemonoparty] skip duplicated patreon files (closes #1689) this behavior can be disabled with the 'patreon-skip-file' option --- docs/configuration.rst | 10 ++++++++++ gallery_dl/extractor/kemonoparty.py | 10 +++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 3eb628b269..8794302f72 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1264,6 +1264,16 @@ Description Extract ``username`` metadata +extractor.kemonoparty.patreon-skip-file +--------------------------------------- +Type + ``bool`` +Default + ``true`` +Description + Skip main files in Patreon posts to avoid duplicates. + + extractor.khinsider.format -------------------------- Type diff --git a/gallery_dl/extractor/kemonoparty.py b/gallery_dl/extractor/kemonoparty.py index 11de4f4cc2..72184884d0 100644 --- a/gallery_dl/extractor/kemonoparty.py +++ b/gallery_dl/extractor/kemonoparty.py @@ -33,6 +33,8 @@ def items(self): KemonopartyExtractor._warning = False find_inline = re.compile(r'src="(/inline/[^"]+)').findall + skip_service = \ + "patreon" if self.config("patreon-skip-file", True) else None if self.config("metadata"): username = text.unescape(text.extract( @@ -54,7 +56,8 @@ def items(self): if file: file["type"] = "file" - append(file) + if post["service"] != skip_service or not post["attachments"]: + append(file) for attachment in post["attachments"]: attachment["type"] = "attachment" append(attachment) @@ -158,6 +161,11 @@ class KemonopartyPostExtractor(KemonopartyExtractor): "options": (("metadata", True),), "keyword": {"username": "Kudalyn's Creations"}, }), + # skip patreon main file (#1667, #1689) + ("https://kemono.party/patreon/user/4158582/post/32099982", { + "count": 2, + "keyword": {"type": "attachment"}, + }), ("https://kemono.party/subscribestar/user/alcorart/post/184330"), )