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

[gelbooru] warn about missing cookies for favorites (#3704)

and add docstring so it shows up in --list-extractors
This commit is contained in:
Mike Fährmann 2023-03-15 14:58:55 +01:00
parent 17bd053d94
commit b756dc13aa
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -56,6 +56,9 @@ class GelbooruBase():
params["tags"] = "{} id:<{}".format(self.tags, post["id"]) params["tags"] = "{} id:<{}".format(self.tags, post["id"])
def _pagination_html(self, params): def _pagination_html(self, params):
if self.cookiedomain and not self._check_cookies(self.cookienames):
self.log.warning("no 'user_id' or 'pass_hash' cookies set")
url = self.root + "/index.php" url = self.root + "/index.php"
params["pid"] = self.page_start * self.per_page params["pid"] = self.page_start * self.per_page
@ -158,7 +161,10 @@ class GelbooruPoolExtractor(GelbooruBase,
class GelbooruFavoriteExtractor(GelbooruBase, class GelbooruFavoriteExtractor(GelbooruBase,
gelbooru_v02.GelbooruV02FavoriteExtractor): gelbooru_v02.GelbooruV02FavoriteExtractor):
"""Extractor for gelbooru favorites"""
pattern = BASE_PATTERN + r"page=favorites&s=view&id=(\d+)" pattern = BASE_PATTERN + r"page=favorites&s=view&id=(\d+)"
cookiedomain = "gelbooru.com"
cookienames = ("user_id", "pass_hash")
test = ("https://gelbooru.com/index.php?page=favorites&s=view&id=12345",) test = ("https://gelbooru.com/index.php?page=favorites&s=view&id=12345",)