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

[deviantart] use '/collections/all' endpoint for favorites

(#3666 ,#3668)
This commit is contained in:
Mike Fährmann 2023-02-17 23:11:35 +01:00
parent 2bd8f2f4bd
commit 725baedad3
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -676,15 +676,9 @@ class DeviantartFavoriteExtractor(DeviantartExtractor):
)
def deviations(self):
folders = self.api.collections_folders(self.user)
if self.flat:
deviations = itertools.chain.from_iterable(
self.api.collections(self.user, folder["folderid"])
for folder in folders
)
if self.offset:
deviations = util.advance(deviations, self.offset)
return deviations
return self.api.collections_all(self.user, self.offset)
folders = self.api.collections_folders(self.user)
return self._folder_urls(
folders, "favourites", DeviantartCollectionExtractor)
@ -1261,6 +1255,13 @@ class DeviantartOAuthAPI():
"mature_content": self.mature}
return self._pagination(endpoint, params)
def collections_all(self, username, offset=0):
"""Yield all deviations in a user's collection"""
endpoint = "/collections/all"
params = {"username": username, "offset": offset, "limit": 24,
"mature_content": self.mature}
return self._pagination(endpoint, params)
@memcache(keyarg=1)
def collections_folders(self, username, offset=0):
"""Yield all collection folders of a specific user"""