[deviantart] add 'quality' option (#369)
This commit is contained in:
@@ -555,6 +555,15 @@ Description Download original files if available.
|
|||||||
=========== =====
|
=========== =====
|
||||||
|
|
||||||
|
|
||||||
|
extractor.deviantart.quality
|
||||||
|
----------------------------
|
||||||
|
=========== =====
|
||||||
|
Type ``integer``
|
||||||
|
Default ``100``
|
||||||
|
Description JPEG compression quality for newer images hosted on wixmp servers.
|
||||||
|
=========== =====
|
||||||
|
|
||||||
|
|
||||||
extractor.deviantart.refresh-token
|
extractor.deviantart.refresh-token
|
||||||
----------------------------------
|
----------------------------------
|
||||||
=========== =====
|
=========== =====
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
"mature": true,
|
"mature": true,
|
||||||
"metadata": false,
|
"metadata": false,
|
||||||
"original": true,
|
"original": true,
|
||||||
|
"quality"; 100,
|
||||||
"wait-min": 0
|
"wait-min": 0
|
||||||
},
|
},
|
||||||
"exhentai":
|
"exhentai":
|
||||||
|
|||||||
@@ -38,11 +38,15 @@ class DeviantartExtractor(Extractor):
|
|||||||
self.offset = 0
|
self.offset = 0
|
||||||
self.flat = self.config("flat", True)
|
self.flat = self.config("flat", True)
|
||||||
self.extra = self.config("extra", False)
|
self.extra = self.config("extra", False)
|
||||||
|
self.quality = self.config("quality", "100")
|
||||||
self.original = self.config("original", True)
|
self.original = self.config("original", True)
|
||||||
self.user = match.group(1) or match.group(2)
|
self.user = match.group(1) or match.group(2)
|
||||||
self.group = False
|
self.group = False
|
||||||
self.api = DeviantartAPI(self)
|
self.api = DeviantartAPI(self)
|
||||||
|
|
||||||
|
if self.quality:
|
||||||
|
self.quality = "q_{}".format(self.quality)
|
||||||
|
|
||||||
if self.original != "image":
|
if self.original != "image":
|
||||||
self._update_content = self._update_content_default
|
self._update_content = self._update_content_default
|
||||||
else:
|
else:
|
||||||
@@ -81,12 +85,15 @@ class DeviantartExtractor(Extractor):
|
|||||||
text.ext_from_url(content["src"]) != "gif":
|
text.ext_from_url(content["src"]) != "gif":
|
||||||
self._update_content(deviation, content)
|
self._update_content(deviation, content)
|
||||||
|
|
||||||
if deviation["index"] <= 790677560 and \
|
if content["src"].startswith("https://images-wixmp-"):
|
||||||
content["src"].startswith("https://images-wixmp-"):
|
if deviation["index"] <= 790677560:
|
||||||
# https://github.com/r888888888/danbooru/issues/4069
|
# https://github.com/r888888888/danbooru/issues/4069
|
||||||
content["src"] = re.sub(
|
content["src"] = re.sub(
|
||||||
r"(/f/[^/]+/[^/]+)/v\d+/.*",
|
r"(/f/[^/]+/[^/]+)/v\d+/.*",
|
||||||
r"/intermediary\1", content["src"])
|
r"/intermediary\1", content["src"])
|
||||||
|
if self.quality:
|
||||||
|
content["src"] = re.sub(
|
||||||
|
r"q_\d+", self.quality, content["src"])
|
||||||
|
|
||||||
yield self.commit(deviation, content)
|
yield self.commit(deviation, content)
|
||||||
|
|
||||||
@@ -385,6 +392,11 @@ class DeviantartDeviationExtractor(DeviantartExtractor):
|
|||||||
"pattern": (r"https://images-wixmp-\w+\.wixmp\.com"
|
"pattern": (r"https://images-wixmp-\w+\.wixmp\.com"
|
||||||
r"/intermediary/f/[^/]+/[^.]+\.jpg$")
|
r"/intermediary/f/[^/]+/[^.]+\.jpg$")
|
||||||
}),
|
}),
|
||||||
|
# wixmp URL rewrite v2 (#369)
|
||||||
|
(("https://www.deviantart.com/josephbiwald/art/"
|
||||||
|
"Destiny-2-Warmind-Secondary-Keyart-804940104"), {
|
||||||
|
"pattern": r"https://images-wixmp-\w+\.wixmp\.com/.*,q_100,"
|
||||||
|
}),
|
||||||
# non-download URL for GIFs (#242)
|
# non-download URL for GIFs (#242)
|
||||||
(("https://www.deviantart.com/skatergators/art/"
|
(("https://www.deviantart.com/skatergators/art/"
|
||||||
"COM-Monique-Model-781571783"), {
|
"COM-Monique-Model-781571783"), {
|
||||||
|
|||||||
Reference in New Issue
Block a user