From a250e9974fd5f0ab9ffcb1ded2eb4e72cd91eb30 Mon Sep 17 00:00:00 2001 From: dirkf Date: Wed, 29 Sep 2021 15:26:47 +0100 Subject: [PATCH] Test for valid URL with HEAD Reverts 4069766c527d10b8e25b9262a3882101367deb3e: originally had HEAD, then changed to GET. Possibly try HEAD and then GET if bad method? Test cases needed. --- youtube_dl/extractor/common.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 797c35fd5..3df237feb 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -53,6 +53,7 @@ from ..utils import ( float_or_none, GeoRestrictedError, GeoUtils, + HEADRequest, int_or_none, js_to_json, JSON_LD_RE, @@ -1469,7 +1470,8 @@ class InfoExtractor(object): if not (url.startswith('http://') or url.startswith('https://')): return True try: - self._request_webpage(url, video_id, 'Checking %s URL' % item, headers=headers) + req = HEADRequest(url, headers=headers) + self._request_webpage(req, video_id, 'Checking %s URL' % item) return True except ExtractorError as e: self.to_screen(