Skip to content

Commit

Permalink
[deviantart] fix GIF downloads (#242)
Browse files Browse the repository at this point in the history
The "original" download URL for GIF animations is only a preview version
of the original file.
  • Loading branch information
mikf committed May 8, 2019
1 parent f347d2d commit 51e0e92
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased
### Fixes
- Download original GIF animations from `deviantart` (#242)

## 1.8.3 - 2019-05-04
### Additions
- Support for
Expand Down
12 changes: 11 additions & 1 deletion gallery_dl/extractor/deviantart.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,18 @@ def items(self):

if "content" in deviation:
content = deviation["content"]
if self.original and deviation["is_downloadable"]:

if self.original and deviation["is_downloadable"] and \
text.ext_from_url(content["src"]) != "gif":
self._update_content(deviation, content)

if deviation["index"] <= 790677560 and \
content["src"].startswith("https://images-wixmp-"):
# https://github.com/r888888888/danbooru/issues/4069
content["src"] = re.sub(
r"(/f/[^/]+/[^/]+)/v\d+/.*",
r"/intermediary\1", content["src"])

yield self.commit(deviation, content)

if "videos" in deviation:
Expand Down Expand Up @@ -339,6 +343,12 @@ class DeviantartDeviationExtractor(DeviantartExtractor):
"pattern": (r"https://images-wixmp-\w+\.wixmp\.com"
r"/intermediary/f/[^/]+/[^.]+\.jpg$")
}),
# non-download URL for GIFs (#242)
(("https://www.deviantart.com/skatergators/art/"
"COM-Monique-Model-781571783"), {
"pattern": (r"https://images-wixmp-\w+\.wixmp\.com"
r"/f/[^/]+/[^.]+\.gif\?token="),
}),
# old-style URLs
("https://shimoda7.deviantart.com"
"/art/For-the-sake-of-a-memory-10073852"),
Expand Down
2 changes: 1 addition & 1 deletion gallery_dl/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.

__version__ = "1.8.3"
__version__ = "1.8.4-dev"

0 comments on commit 51e0e92

Please sign in to comment.