[deviantart] use fallback for /intermediary/ URLs

instead of checking availability with HEAD requests
pull/1405/head
Mike Fährmann 4 years ago
parent 15daa62842
commit dc23cfd684
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -1,5 +1,7 @@
# Changelog
## Unreleased
## 1.17.1 - 2021-03-19
### Additions
- [architizer] add `project` and `firm` extractors ([#1369](https://github.com/mikf/gallery-dl/issues/1369))

@ -105,7 +105,8 @@ class DeviantartExtractor(Extractor):
intermediary, count = re.subn(
r"(/f/[^/]+/[^/]+)/v\d+/.*",
r"/intermediary\1", content["src"], 1)
if count and self._check_url(intermediary):
if count:
deviation["_fallback"] = (content["src"],)
content["src"] = intermediary
if self.quality:
content["src"] = re.sub(
@ -282,9 +283,6 @@ class DeviantartExtractor(Extractor):
if mtype and mtype.startswith("image/"):
content.update(data)
def _check_url(self, url):
return self.request(url, method="HEAD", fatal=False).status_code < 400
def _limited_request(self, url, **kwargs):
"""Limits HTTP requests to one every 2 seconds"""
kwargs["fatal"] = None

@ -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.17.1"
__version__ = "1.17.2-dev"

Loading…
Cancel
Save