[deviantart] use '/collections/all' endpoint for favorites
(#3666 ,#3668)
This commit is contained in:
@@ -676,15 +676,9 @@ class DeviantartFavoriteExtractor(DeviantartExtractor):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def deviations(self):
|
def deviations(self):
|
||||||
folders = self.api.collections_folders(self.user)
|
|
||||||
if self.flat:
|
if self.flat:
|
||||||
deviations = itertools.chain.from_iterable(
|
return self.api.collections_all(self.user, self.offset)
|
||||||
self.api.collections(self.user, folder["folderid"])
|
folders = self.api.collections_folders(self.user)
|
||||||
for folder in folders
|
|
||||||
)
|
|
||||||
if self.offset:
|
|
||||||
deviations = util.advance(deviations, self.offset)
|
|
||||||
return deviations
|
|
||||||
return self._folder_urls(
|
return self._folder_urls(
|
||||||
folders, "favourites", DeviantartCollectionExtractor)
|
folders, "favourites", DeviantartCollectionExtractor)
|
||||||
|
|
||||||
@@ -1261,6 +1255,13 @@ class DeviantartOAuthAPI():
|
|||||||
"mature_content": self.mature}
|
"mature_content": self.mature}
|
||||||
return self._pagination(endpoint, params)
|
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)
|
@memcache(keyarg=1)
|
||||||
def collections_folders(self, username, offset=0):
|
def collections_folders(self, username, offset=0):
|
||||||
"""Yield all collection folders of a specific user"""
|
"""Yield all collection folders of a specific user"""
|
||||||
|
|||||||
Reference in New Issue
Block a user