@@ -11,6 +11,7 @@
|
|||||||
from .common import Extractor, Message
|
from .common import Extractor, Message
|
||||||
from .. import text, exception
|
from .. import text, exception
|
||||||
from ..cache import cache
|
from ..cache import cache
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
class DeviantartUserExtractor(Extractor):
|
class DeviantartUserExtractor(Extractor):
|
||||||
@@ -137,11 +138,14 @@ class DeviantartAPI():
|
|||||||
|
|
||||||
def gallery_all(self, username, offset=0):
|
def gallery_all(self, username, offset=0):
|
||||||
"""Yield all Deviation-objects of a specific user """
|
"""Yield all Deviation-objects of a specific user """
|
||||||
self.authenticate()
|
|
||||||
url = "https://www.deviantart.com/api/v1/oauth2/gallery/all"
|
url = "https://www.deviantart.com/api/v1/oauth2/gallery/all"
|
||||||
params = {"username": username, "offset": offset}
|
params = {"username": username, "offset": offset}
|
||||||
while True:
|
while True:
|
||||||
|
self.authenticate()
|
||||||
data = self.session.get(url, params=params).json()
|
data = self.session.get(url, params=params).json()
|
||||||
|
if "results" not in data:
|
||||||
|
print("Something went wrong:", data, sep="\n", file=sys.stderr)
|
||||||
|
return
|
||||||
yield from data["results"]
|
yield from data["results"]
|
||||||
if not data["has_more"]:
|
if not data["has_more"]:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user