[paheal] add 'metadata' option (#2641)
This commit is contained in:
@@ -1761,6 +1761,18 @@ Description
|
|||||||
port than the default.
|
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
|
extractor.patreon.files
|
||||||
-----------------------
|
-----------------------
|
||||||
Type
|
Type
|
||||||
|
|||||||
@@ -195,6 +195,10 @@
|
|||||||
"cache": true,
|
"cache": true,
|
||||||
"port": 6414
|
"port": 6414
|
||||||
},
|
},
|
||||||
|
"paheal":
|
||||||
|
{
|
||||||
|
"metadata": false
|
||||||
|
},
|
||||||
"pillowfort":
|
"pillowfort":
|
||||||
{
|
{
|
||||||
"external": false,
|
"external": false,
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class PahealExtractor(Extractor):
|
|||||||
post["width"], _, post["height"] = dimensions.partition("x")
|
post["width"], _, post["height"] = dimensions.partition("x")
|
||||||
post["size"] = text.parse_bytes(size[:-1])
|
post["size"] = text.parse_bytes(size[:-1])
|
||||||
|
|
||||||
return (post,)
|
return post
|
||||||
|
|
||||||
|
|
||||||
class PahealTagExtractor(PahealExtractor):
|
class PahealTagExtractor(PahealExtractor):
|
||||||
@@ -81,6 +81,9 @@ class PahealTagExtractor(PahealExtractor):
|
|||||||
PahealExtractor.__init__(self, match)
|
PahealExtractor.__init__(self, match)
|
||||||
self.tags = text.unquote(match.group(1))
|
self.tags = text.unquote(match.group(1))
|
||||||
|
|
||||||
|
if self.config("metadata"):
|
||||||
|
self._extract_data = self._extract_data_ex
|
||||||
|
|
||||||
def get_metadata(self):
|
def get_metadata(self):
|
||||||
return {"search_tags": self.tags}
|
return {"search_tags": self.tags}
|
||||||
|
|
||||||
@@ -114,8 +117,13 @@ class PahealTagExtractor(PahealExtractor):
|
|||||||
"width": width, "height": height,
|
"width": width, "height": height,
|
||||||
"tags": text.unescape(tags),
|
"tags": text.unescape(tags),
|
||||||
"size": text.parse_bytes(size[:-1]),
|
"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):
|
class PahealPostExtractor(PahealExtractor):
|
||||||
"""Extractor for single images from rule34.paheal.net"""
|
"""Extractor for single images from rule34.paheal.net"""
|
||||||
@@ -162,4 +170,4 @@ class PahealPostExtractor(PahealExtractor):
|
|||||||
self.post_id = match.group(1)
|
self.post_id = match.group(1)
|
||||||
|
|
||||||
def get_posts(self):
|
def get_posts(self):
|
||||||
return self._extract_post(self.post_id)
|
return (self._extract_post(self.post_id),)
|
||||||
|
|||||||
Reference in New Issue
Block a user