[paheal] implement fast '--range' support (#5905)
This commit is contained in:
@@ -77,6 +77,7 @@ class PahealTagExtractor(PahealExtractor):
|
|||||||
pattern = (r"(?:https?://)?(?:rule34|rule63|cosplay)\.paheal\.net"
|
pattern = (r"(?:https?://)?(?:rule34|rule63|cosplay)\.paheal\.net"
|
||||||
r"/post/list/([^/?#]+)")
|
r"/post/list/([^/?#]+)")
|
||||||
example = "https://rule34.paheal.net/post/list/TAG/1"
|
example = "https://rule34.paheal.net/post/list/TAG/1"
|
||||||
|
page_start = 1
|
||||||
per_page = 70
|
per_page = 70
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
@@ -87,11 +88,16 @@ class PahealTagExtractor(PahealExtractor):
|
|||||||
if self.config("metadata"):
|
if self.config("metadata"):
|
||||||
self._extract_data = self._extract_data_ex
|
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):
|
def get_metadata(self):
|
||||||
return {"search_tags": self.tags}
|
return {"search_tags": self.tags}
|
||||||
|
|
||||||
def get_posts(self):
|
def get_posts(self):
|
||||||
pnum = 1
|
pnum = self.page_start
|
||||||
while True:
|
while True:
|
||||||
url = "{}/post/list/{}/{}".format(self.root, self.tags, pnum)
|
url = "{}/post/list/{}/{}".format(self.root, self.tags, pnum)
|
||||||
page = self.request(url).text
|
page = self.request(url).text
|
||||||
|
|||||||
Reference in New Issue
Block a user