Skip to content

Commit

Permalink
[kemonoparty] skip duplicated patreon files (closes #1689)
Browse files Browse the repository at this point in the history
this behavior can be disabled with the 'patreon-skip-file' option
  • Loading branch information
mikf committed Jul 23, 2021
1 parent da7297c commit 4864748
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion gallery_dl/extractor/kemonoparty.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
Expand Down Expand Up @@ -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"),
)

Expand Down

0 comments on commit 4864748

Please sign in to comment.