[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
3 changed files with 5 additions and 5 deletions

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"