diff options
| author | 2022-08-29 02:17:16 -0400 | |
|---|---|---|
| committer | 2022-08-29 02:17:16 -0400 | |
| commit | a768930761f7f20587ae40a8cacca0e55c85290a (patch) | |
| tree | 5a4163db912b93fc45f717e5e43fd5be3e66f16c /gallery_dl/extractor/wallhaven.py | |
| parent | ae2a0f5622beaa6f402526f8a7b939419283a090 (diff) | |
New upstream version 1.23.0.upstream/1.23.0
Diffstat (limited to 'gallery_dl/extractor/wallhaven.py')
| -rw-r--r-- | gallery_dl/extractor/wallhaven.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gallery_dl/extractor/wallhaven.py b/gallery_dl/extractor/wallhaven.py index 37eab24..0ad8523 100644 --- a/gallery_dl/extractor/wallhaven.py +++ b/gallery_dl/extractor/wallhaven.py @@ -189,7 +189,7 @@ class WallhavenAPI(): def collections(self, username): endpoint = "/v1/collections/" + username - return self._pagination(endpoint) + return self._pagination(endpoint, metadata=False) def search(self, params): endpoint = "/v1/search" @@ -200,13 +200,20 @@ class WallhavenAPI(): return self.extractor.request( url, headers=self.headers, params=params).json() - def _pagination(self, endpoint, params=None): + def _pagination(self, endpoint, params=None, metadata=None): if params is None: params = {} + if metadata is None: + metadata = self.extractor.config("metadata") while True: data = self._call(endpoint, params) - yield from data["data"] + + if metadata: + for wp in data["data"]: + yield self.info(str(wp["id"])) + else: + yield from data["data"] meta = data.get("meta") if not meta or meta["current_page"] >= meta["last_page"]: |
