1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2025-01-31 11:41:35 +01:00

[paheal] implement fast '--range' support (#5905)

This commit is contained in:
Mike Fährmann 2024-07-30 12:55:57 +02:00
parent ca3e7a5e5a
commit d2dda2bc00
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -77,6 +77,7 @@ class PahealTagExtractor(PahealExtractor):
pattern = (r"(?:https?://)?(?:rule34|rule63|cosplay)\.paheal\.net"
r"/post/list/([^/?#]+)")
example = "https://rule34.paheal.net/post/list/TAG/1"
page_start = 1
per_page = 70
def __init__(self, match):
@ -87,11 +88,16 @@ class PahealTagExtractor(PahealExtractor):
if self.config("metadata"):
self._extract_data = self._extract_data_ex
def skip(self, num):
pages = num // self.per_page
self.page_start += pages
return pages * self.per_page
def get_metadata(self):
return {"search_tags": self.tags}
def get_posts(self):
pnum = 1
pnum = self.page_start
while True:
url = "{}/post/list/{}/{}".format(self.root, self.tags, pnum)
page = self.request(url).text