1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

[deviantart] use fallback for /intermediary/ URLs

instead of checking availability with HEAD requests
This commit is contained in:
Mike Fährmann 2021-03-20 00:10:53 +01:00
parent 15daa62842
commit dc23cfd684
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 5 additions and 5 deletions

View File

@ -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))

View File

@ -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

View File

@ -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"