diff --git a/docs/configuration.rst b/docs/configuration.rst
index 4c73b2c1..e6aa99c4 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -1176,6 +1176,16 @@ Description
Download video files.
+extractor.kemonoparty.metadata
+------------------------------
+Type
+ ``bool``
+Default
+ ``false``
+Description
+ Extract ``username`` metadata
+
+
extractor.khinsider.format
--------------------------
Type
diff --git a/gallery_dl/extractor/kemonoparty.py b/gallery_dl/extractor/kemonoparty.py
index d0c0fe37..3abf11be 100644
--- a/gallery_dl/extractor/kemonoparty.py
+++ b/gallery_dl/extractor/kemonoparty.py
@@ -26,6 +26,12 @@ class KemonopartyExtractor(Extractor):
def items(self):
find_inline = re.compile(r'src="(/inline/[^"]+)').findall
+ if self.config("metadata"):
+ username = text.unescape(text.extract(
+ self.request(self.user_url).text, "
", " | Kemono<")[0])
+ else:
+ username = None
+
for post in self.posts():
files = []
@@ -38,6 +44,8 @@ class KemonopartyExtractor(Extractor):
post["date"] = text.parse_datetime(
post["published"], "%a, %d %b %Y %H:%M:%S %Z")
+ if username:
+ post["username"] = username
yield Message.Directory, post
for post["num"], file in enumerate(files, 1):
@@ -67,6 +75,7 @@ class KemonopartyUserExtractor(KemonopartyExtractor):
KemonopartyExtractor.__init__(self, match)
service, user_id = match.groups()
self.api_url = "{}/api/{}/user/{}".format(self.root, service, user_id)
+ self.user_url = "{}/{}/user/{}".format(self.root, service, user_id)
def posts(self):
url = self.api_url
@@ -125,6 +134,7 @@ class KemonopartyPostExtractor(KemonopartyExtractor):
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)
def posts(self):
posts = self.request(self.api_url).json()