mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
[deviantart] add 'png' option (#4846)
This commit is contained in:
parent
966c8608e6
commit
9cc4ec2c58
@ -1506,6 +1506,17 @@ Description
|
||||
* ``"manual"``: Disregard ``has_more`` and only stop when a batch of results is empty.
|
||||
|
||||
|
||||
extractor.deviantart.png
|
||||
------------------------
|
||||
Type
|
||||
``bool``
|
||||
Default
|
||||
``false``
|
||||
Description
|
||||
Download the PNG version of images
|
||||
for which an original file download is not available.
|
||||
|
||||
|
||||
extractor.deviantart.public
|
||||
---------------------------
|
||||
Type
|
||||
|
@ -43,6 +43,7 @@ class DeviantartExtractor(Extractor):
|
||||
|
||||
def _init(self):
|
||||
self.jwt = self.config("jwt", False)
|
||||
self.png = self.config("png", False)
|
||||
self.flat = self.config("flat", True)
|
||||
self.extra = self.config("extra", False)
|
||||
self.quality = self.config("quality", "100")
|
||||
@ -65,6 +66,10 @@ class DeviantartExtractor(Extractor):
|
||||
self.quality = ",q_{}".format(self.quality)
|
||||
self.quality_sub = re.compile(r",q_\d+").sub
|
||||
|
||||
if self.png:
|
||||
self.png = "-fullview.png?"
|
||||
self.png_sub = re.compile(r"-fullview\.[a-z0-9]+\?").sub
|
||||
|
||||
if self.original != "image":
|
||||
self._update_content = self._update_content_default
|
||||
else:
|
||||
@ -345,6 +350,9 @@ class DeviantartExtractor(Extractor):
|
||||
if self.quality:
|
||||
content["src"] = self.quality_sub(
|
||||
self.quality, content["src"], 1)
|
||||
if self.png:
|
||||
content["src"] = self.png_sub(
|
||||
self.png, content["src"], 1)
|
||||
|
||||
return content
|
||||
|
||||
|
@ -732,8 +732,7 @@ __tests__ = (
|
||||
"#comment" : "journal",
|
||||
"#category": ("", "deviantart", "deviation"),
|
||||
"#class" : deviantart.DeviantartDeviationExtractor,
|
||||
"#pattern" : """text:<!DOCTYPE html>
|
||||
""",
|
||||
"#pattern" : """text:<!DOCTYPE html>\n""",
|
||||
"#sha1_url": "d34b2c9f873423e665a1b8ced20fcb75951694a3",
|
||||
},
|
||||
|
||||
@ -754,6 +753,22 @@ __tests__ = (
|
||||
"#count" : 0,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.deviantart.com/colibriworkshop/art/Crimson-Pandaren-Phoenix-World-of-Warcraft-630984457",
|
||||
"#comment" : "'png' option (#4846)",
|
||||
"#category": ("", "deviantart", "deviation"),
|
||||
"#class" : deviantart.DeviantartDeviationExtractor,
|
||||
"#options" : {"png": True, "intermediary": False},
|
||||
"#sha1_content": "75fb92a820b154c061f7e1f9935260577b2365ec",
|
||||
"#pattern" : r"https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com"
|
||||
r"/f/d86d1faa-37a8-4bcb-b421-53331885d763/dafo6q1-5c4c999a-019e-4845-8c29-6fab2d05c8e8\.jpg"
|
||||
r"/v1/fill/w_1024,h_1297,q_100,strp"
|
||||
r"/crimson_pandaren_phoenix_world_of_warcraft_by_colibriworkshop_dafo6q1-fullview\.png"
|
||||
r"\?token=ey.+",
|
||||
|
||||
"extension": "png",
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://deviantart.com/view/904858796/",
|
||||
"#comment" : "/view/ URLs",
|
||||
|
Loading…
Reference in New Issue
Block a user