diff --git a/gallery_dl/extractor/deviantart.py b/gallery_dl/extractor/deviantart.py
index 5d778cec..d971219e 100644
--- a/gallery_dl/extractor/deviantart.py
+++ b/gallery_dl/extractor/deviantart.py
@@ -385,21 +385,97 @@ class DeviantartExtractor(Extractor):
state = util.json_loads(text.extr(
page, 'window.__INITIAL_STATE__ = JSON.parse("', '");')
.replace("\\\\", "\\").replace("\\'", "'").replace('\\"', '"'))
-
deviations = state["@@entities"]["deviation"]
content = deviations.popitem()[1]["textContent"]
- html = content["html"]["markup"]
- if html.startswith("{"):
- self.log.warning("%s: Unsupported '%s' markup.",
- deviation["index"], content["html"]["type"])
- html = content["excerpt"].replace("\n", "
")
- return {"html": html}
+ html = self._textcontent_to_html(deviation, content)
+ if html:
+ return {"html": html}
+ return {"html": content["excerpt"].replace("\n", "
")}
if "body" in deviation:
return {"html": deviation.pop("body")}
return None
+ def _textcontent_to_html(self, deviation, content):
+ html = content["html"]
+ markup = html["markup"]
+
+ if not markup.startswith("{"):
+ return markup
+
+ if html["type"] == "tiptap":
+ return self._tiptap_to_html(markup)
+
+ self.log.warning("%s: Unsupported '%s' markup.",
+ deviation["index"], html["type"])
+
+ def _tiptap_to_html(self, markup):
+ html = []
+
+ html.append('
') + + for block in content["content"]: + self._tiptap_process_content(html, block) + + html.append("
") + + elif type == "text": + html.append(text.escape(content["text"])) + + elif type == "hardBreak": + html.append("