'
- header = HEADER_CUSTOM_TEMPLATE.format(
+ header = tmpl.HEADER_CUSTOM.format(
title=title, url=url, date=deviation["date"],
)
else:
needle = '
'
username = deviation["author"]["username"]
urlname = deviation.get("username") or username.lower()
- header = HEADER_TEMPLATE.format(
+ header = tmpl.HEADER.format(
title=title,
url=url,
userurl=f"{self.root}/{urlname}/",
@@ -326,9 +327,9 @@ class DeviantartExtractor(Extractor):
if needle in html:
html = html.replace(needle, header, 1)
else:
- html = JOURNAL_TEMPLATE_HTML_EXTRA.format(header, html)
+ html = tmpl.HTML_EXTRA.format(header, html)
- html = JOURNAL_TEMPLATE_HTML.format(
+ html = tmpl.HTML.format(
title=title, html=html, shadow=shadow, css=css, cls=cls)
deviation["extension"] = "htm"
@@ -345,7 +346,7 @@ class DeviantartExtractor(Extractor):
text.unescape(text.remove_html(txt))
for txt in (head or tail).split("
")
)
- txt = JOURNAL_TEMPLATE_TEXT.format(
+ txt = self.utils("journal").TEXT.format(
title=deviation["title"],
username=deviation["author"]["username"],
date=deviation["date"],
@@ -1869,6 +1870,9 @@ def _login_impl(extr, username, password):
}
+_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"
+
+
def id_from_base36(base36):
return util.bdecode(base36, _ALPHABET)
@@ -1877,121 +1881,6 @@ def base36_from_id(deviation_id):
return util.bencode(int(deviation_id), _ALPHABET)
-_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"
-
-
-###############################################################################
-# Journal Formats #############################################################
-
-SHADOW_TEMPLATE = """
-
-
-
-
-"""
-
-HEADER_TEMPLATE = """
-
-"""
-
-HEADER_CUSTOM_TEMPLATE = """
-
-Journal Entry:
{date}
-"""
-
-JOURNAL_TEMPLATE_HTML = """text:
-
-
-
-
{title}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-"""
-
-JOURNAL_TEMPLATE_HTML_EXTRA = """\
-
"""
-
-JOURNAL_TEMPLATE_TEXT = """text:{title}
-by {username}, {date}
-
-{content}
-"""
-
-
def eclipse_media(media, format="preview"):
url = [media["baseUri"]]
diff --git a/gallery_dl/extractor/utils/deviantart_journal.py b/gallery_dl/extractor/utils/deviantart_journal.py
new file mode 100644
index 00000000..6c4ecf35
--- /dev/null
+++ b/gallery_dl/extractor/utils/deviantart_journal.py
@@ -0,0 +1,116 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2026 Mike Fährmann
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+
+
+SHADOW = """
+
+
+
+
+"""
+
+HEADER = """
+
+"""
+
+HEADER_CUSTOM = """
+
+Journal Entry:
{date}
+"""
+
+HTML = """text:
+
+
+
+
{title}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"""
+
+HTML_EXTRA = """\
+
"""
+
+TEXT = """text:{title}
+by {username}, {date}
+
+{content}
+"""