mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 04:02:32 +01:00
[paheal] add 'metadata' option (#2641)
This commit is contained in:
parent
535cbcb185
commit
4b78bd423f
@ -1761,6 +1761,18 @@ Description
|
||||
port than the default.
|
||||
|
||||
|
||||
extractor.paheal.metadata
|
||||
-------------------------
|
||||
Type
|
||||
``bool``
|
||||
Default
|
||||
``false``
|
||||
Description
|
||||
Extract additional metadata (``source``, ``uploader``)
|
||||
|
||||
Note: This requires 1 additional HTTP request per post.
|
||||
|
||||
|
||||
extractor.patreon.files
|
||||
-----------------------
|
||||
Type
|
||||
|
@ -195,6 +195,10 @@
|
||||
"cache": true,
|
||||
"port": 6414
|
||||
},
|
||||
"paheal":
|
||||
{
|
||||
"metadata": false
|
||||
},
|
||||
"pillowfort":
|
||||
{
|
||||
"external": false,
|
||||
|
@ -62,7 +62,7 @@ class PahealExtractor(Extractor):
|
||||
post["width"], _, post["height"] = dimensions.partition("x")
|
||||
post["size"] = text.parse_bytes(size[:-1])
|
||||
|
||||
return (post,)
|
||||
return post
|
||||
|
||||
|
||||
class PahealTagExtractor(PahealExtractor):
|
||||
@ -81,6 +81,9 @@ class PahealTagExtractor(PahealExtractor):
|
||||
PahealExtractor.__init__(self, match)
|
||||
self.tags = text.unquote(match.group(1))
|
||||
|
||||
if self.config("metadata"):
|
||||
self._extract_data = self._extract_data_ex
|
||||
|
||||
def get_metadata(self):
|
||||
return {"search_tags": self.tags}
|
||||
|
||||
@ -114,8 +117,13 @@ class PahealTagExtractor(PahealExtractor):
|
||||
"width": width, "height": height,
|
||||
"tags": text.unescape(tags),
|
||||
"size": text.parse_bytes(size[:-1]),
|
||||
"date": text.parse_datetime(date, "%B %d, %Y; %H:%M"),
|
||||
}
|
||||
|
||||
def _extract_data_ex(self, post):
|
||||
pid = post[:post.index('"')]
|
||||
return self._extract_post(pid)
|
||||
|
||||
|
||||
class PahealPostExtractor(PahealExtractor):
|
||||
"""Extractor for single images from rule34.paheal.net"""
|
||||
@ -162,4 +170,4 @@ class PahealPostExtractor(PahealExtractor):
|
||||
self.post_id = match.group(1)
|
||||
|
||||
def get_posts(self):
|
||||
return self._extract_post(self.post_id)
|
||||
return (self._extract_post(self.post_id),)
|
||||
|
Loading…
Reference in New Issue
Block a user