1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-23 11:12:40 +01:00

[deviantart] remove mature scraps warning (#3691)

warn about private deviations
when paginating over eclipse results
This commit is contained in:
Mike Fährmann 2023-02-23 22:56:37 +01:00
parent 51301e0c31
commit 3fa456d989
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -34,7 +34,6 @@ class DeviantartExtractor(Extractor):
filename_fmt = "{category}_{index}_{title}.{extension}" filename_fmt = "{category}_{index}_{title}.{extension}"
cookiedomain = None cookiedomain = None
cookienames = ("auth", "auth_secure", "userinfo") cookienames = ("auth", "auth_secure", "userinfo")
_warning = True
_last_request = 0 _last_request = 0
def __init__(self, match): def __init__(self, match):
@ -74,13 +73,10 @@ class DeviantartExtractor(Extractor):
def login(self): def login(self):
if not self._check_cookies(self.cookienames): if not self._check_cookies(self.cookienames):
username, password = self._get_auth_info() username, password = self._get_auth_info()
if username: if not username:
self._update_cookies(_login_impl(self, username, password)) return False
elif self._warning: self._update_cookies(_login_impl(self, username, password))
self.log.warning( return True
"No session cookies or login credentials available. "
"Unable to fetch mature-rated content.")
DeviantartExtractor._warning = False
def items(self): def items(self):
self.api = DeviantartOAuthAPI(self) self.api = DeviantartOAuthAPI(self)
@ -1735,12 +1731,21 @@ class DeviantartEclipseAPI():
return {"error": response.text} return {"error": response.text}
def _pagination(self, endpoint, params, key="results"): def _pagination(self, endpoint, params, key="results"):
limit = params.get("limit", 24)
warn = True
while True: while True:
data = self._call(endpoint, params) data = self._call(endpoint, params)
results = data.get(key) results = data.get(key)
if results is None: if results is None:
return return
if len(results) < limit and warn and data.get("hasMore"):
warn = False
self.log.warning(
"Private deviations detected! "
"Provide login credentials or session cookies "
"to be able to access them.")
yield from results yield from results
if not data.get("hasMore"): if not data.get("hasMore"):