[deviantart] use '/collections/all' endpoint for favorites
(#3666 ,#3668)
This commit is contained in:
@@ -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"""
|
||||
|
||||
Reference in New Issue
Block a user