summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/deviantart.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/extractor/deviantart.py')
-rw-r--r--gallery_dl/extractor/deviantart.py38
1 files changed, 30 insertions, 8 deletions
diff --git a/gallery_dl/extractor/deviantart.py b/gallery_dl/extractor/deviantart.py
index 6614755..525cc84 100644
--- a/gallery_dl/extractor/deviantart.py
+++ b/gallery_dl/extractor/deviantart.py
@@ -620,7 +620,7 @@ class DeviantartExtractorV2(DeviantartExtractor):
# extract download target
target = files[-1]
- if deviation["isJournal"] and self.commit_journal:
+ if "textContent" in deviation and self.commit_journal:
journal = deviation["textContent"]
journal["html"] = journal["html"]["markup"]
target["src"] = self.commit_journal(deviation, journal)[1]
@@ -729,6 +729,16 @@ class DeviantartDeviationExtractor(DeviantartExtractorV2):
("https://www.deviantart.com/ikatxfruti/art/Bang-Bang-528130222", {
"pattern": r"https://images-wixmp-.*wixmp.com/f/.*\.swf",
}),
+ # journal
+ ("https://www.deviantart.com/shimoda7/journal/ARTility-583755752", {
+ "url": "f33f8127ab71819be7de849175b6d5f8b37bb629",
+ "pattern": "text:<!DOCTYPE html>\n",
+ }),
+ # journal-like post with isJournal == False (#419)
+ ("https://www.deviantart.com/gliitchlord/art/brashstrokes-812942668", {
+ "url": "1534d6ea0561247ab921d07505e57a9d663a833b",
+ "pattern": "text:<!DOCTYPE html>\n",
+ }),
# old-style URLs
("https://shimoda7.deviantart.com"
"/art/For-the-sake-of-a-memory-10073852"),
@@ -818,6 +828,12 @@ class DeviantartAPI():
self.client_secret = extractor.config(
"client-secret", self.CLIENT_SECRET)
+ self.log.debug(
+ "Using %s API credentials (client-id %s)",
+ "default" if self.client_id == self.CLIENT_ID else "custom",
+ self.client_id,
+ )
+
def browse_popular(self, query=None, timerange=None,
category_path=None, offset=0):
"""Yield popular deviations"""
@@ -873,6 +889,8 @@ class DeviantartAPI():
def deviation_metadata(self, deviations):
""" Fetch deviation metadata for a set of deviations"""
+ if not deviations:
+ return []
endpoint = "deviation/metadata?" + "&".join(
"deviationids[{}]={}".format(num, deviation["deviationid"])
for num, deviation in enumerate(deviations)
@@ -953,7 +971,7 @@ class DeviantartAPI():
if self.delay > self.delay_min:
self.delay -= 1
return data
- if not fatal:
+ if not fatal and status != 429:
return None
if data.get("error_description") == "User not found.":
raise exception.NotFoundError("user or group")
@@ -975,13 +993,18 @@ class DeviantartAPI():
if "results" not in data:
self.log.error("Unexpected API response: %s", data)
return
- if (public and self.refresh_token and
- len(data["results"]) < params["limit"]):
- self.log.debug("Switching to private access token")
- public = False
- continue
if extend:
+ if public and len(data["results"]) < params["limit"]:
+ if self.refresh_token:
+ self.log.debug("Switching to private access token")
+ public = False
+ continue
+ elif data["has_more"]:
+ self.log.warning(
+ "Private deviations detected! Run 'gallery-dl "
+ "oauth:deviantart' and follow the instructions to "
+ "be able to access them.")
if self.metadata:
self._metadata(data["results"])
if self.folders:
@@ -1003,7 +1026,6 @@ class DeviantartAPI():
deviations, self.deviation_metadata(deviations)):
deviation.update(metadata)
deviation["tags"] = [t["tag_name"] for t in deviation["tags"]]
- return deviations
def _folders(self, deviations):
"""Add a list of all containing folders to each deviation object"""