From 759735fb023cb7f80c2f467127fc1d886305e3b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 25 Jun 2021 14:47:12 +0200 Subject: [PATCH] [kemonoparty] fix 'username' extraction (fixes #1652) The site's content changed from <title>NAME | Kemono to NAME | Kemono --- gallery_dl/extractor/kemonoparty.py | 8 +++++++- test/test_results.py | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/kemonoparty.py b/gallery_dl/extractor/kemonoparty.py index 8c51d5d7..a1239308 100644 --- a/gallery_dl/extractor/kemonoparty.py +++ b/gallery_dl/extractor/kemonoparty.py @@ -28,7 +28,8 @@ class KemonopartyExtractor(Extractor): if self.config("metadata"): username = text.unescape(text.extract( - self.request(self.user_url).text, "", " | Kemono<")[0]) + self.request(self.user_url).text, "<title>", " | Kemono" + )[0]).lstrip() else: username = None @@ -133,6 +134,11 @@ class KemonopartyPostExtractor(KemonopartyExtractor): "pattern": r"https://data\.kemono\.party/(file|attachment)s" r"/gumroad/trylsc/IURjT/", }), + # username (#1548, #1652) + ("https://kemono.party/gumroad/user/3252870377455/post/aJnAH", { + "options": (("metadata", True),), + "keyword": {"username": "Kudalyn's Creations"}, + }), ("https://kemono.party/subscribestar/user/alcorart/post/184330"), ) diff --git a/test/test_results.py b/test/test_results.py index 5b22ecde..9c6845d2 100644 --- a/test/test_results.py +++ b/test/test_results.py @@ -315,6 +315,9 @@ def setup_test_config(): "e621", "inkbunny", "tapas", "pillowfort", "mangadex"): config.set(("extractor", category), "username", None) + config.set(("extractor", "kemonoparty"), "cookies", { + "__ddg1": "0gBDGpJ3KZQmA4B9QH25", "__ddg2": "lmj5s1jnJOvhPXCX"}) + config.set(("extractor", "mastodon.social"), "access-token", "Blf9gVqG7GytDTfVMiyYQjwVMQaNACgf3Ds3IxxVDUQ")