From 6c5c0bac3bd4ce906905f39844e637d30071ad5a Mon Sep 17 00:00:00 2001 From: Barak Tawily Date: Tue, 6 Nov 2018 17:17:06 +0200 Subject: [PATCH 1/6] skip_http_head flag added --- youtube_dl/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index ba435ea42..a8e478458 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -403,6 +403,7 @@ def _real_main(argv=None): 'prefer_ffmpeg': opts.prefer_ffmpeg, 'include_ads': opts.include_ads, 'default_search': opts.default_search, + 'skip_http_head': opts.skip_http_head, 'youtube_include_dash_manifest': opts.youtube_include_dash_manifest, 'encoding': opts.encoding, 'extract_flat': opts.extract_flat, From 626fcaa22a9af23c1aee814a285c944d8bc182af Mon Sep 17 00:00:00 2001 From: Barak Tawily Date: Tue, 6 Nov 2018 17:17:52 +0200 Subject: [PATCH 2/6] skip_http_head flag added --- youtube_dl/extractor/generic.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py index 545e03371..cba0b4f49 100644 --- a/youtube_dl/extractor/generic.py +++ b/youtube_dl/extractor/generic.py @@ -2226,13 +2226,15 @@ class GenericIE(InfoExtractor): else: video_id = self._generic_id(url) - self.to_screen('%s: Requesting header' % video_id) - - head_req = HEADRequest(url) - head_response = self._request_webpage( - head_req, video_id, - note=False, errnote='Could not send HEAD request to %s' % url, - fatal=False) + if self._downloader.params.get('skip_http_head') == None: + head_response = False + else: + self.to_screen('%s: Requesting header' % video_id) + head_req = HEADRequest(url) + head_response = self._request_webpage( + head_req, video_id, + note=False, errnote='Could not send HEAD request to %s' % url, + fatal=False) if head_response is not False: # Check for redirect From 04e7bf92a085c80bc9aff307959da7a182c69b74 Mon Sep 17 00:00:00 2001 From: Barak Tawily Date: Tue, 6 Nov 2018 17:18:21 +0200 Subject: [PATCH 3/6] skip-http-head flag added --- youtube_dl/options.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/youtube_dl/options.py b/youtube_dl/options.py index e7d8e8910..a89d602a8 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -226,6 +226,13 @@ def parseOpts(overrideArguments=None): action='store_const', const='::', dest='source_address', help='Make all connections via IPv6', ) + network.add_option( + '--skip-http-head', + action='store_const', default=False, dest='skip_http_head', + help='Skip the initial HTTP head request', + ) + + geo = optparse.OptionGroup(parser, 'Geo Restriction') geo.add_option( From bce31627dfdd293a578106e597f288668975e9b2 Mon Sep 17 00:00:00 2001 From: Barak Tawily Date: Fri, 23 Nov 2018 22:48:24 +0200 Subject: [PATCH 4/6] Update __init__.py --- youtube_dl/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index a8e478458..ff744b971 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -403,7 +403,7 @@ def _real_main(argv=None): 'prefer_ffmpeg': opts.prefer_ffmpeg, 'include_ads': opts.include_ads, 'default_search': opts.default_search, - 'skip_http_head': opts.skip_http_head, + 'skip_http_head': opts.generic_skip_http_head, 'youtube_include_dash_manifest': opts.youtube_include_dash_manifest, 'encoding': opts.encoding, 'extract_flat': opts.extract_flat, From a7513787a4dc1f327da751da545edb32175a977a Mon Sep 17 00:00:00 2001 From: Barak Tawily Date: Fri, 23 Nov 2018 22:49:14 +0200 Subject: [PATCH 5/6] Update options.py --- youtube_dl/options.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/youtube_dl/options.py b/youtube_dl/options.py index a89d602a8..e7dea1172 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -198,6 +198,11 @@ def parseOpts(overrideArguments=None): action='store_true', dest='no_color', default=False, help='Do not emit color codes in output') + general.add_option( + '--skip-http-head', + action='store_const', default=False, dest='generic_skip_http_head', + help='Skip the initial HTTP head request', + ) network = optparse.OptionGroup(parser, 'Network Options') network.add_option( @@ -226,12 +231,6 @@ def parseOpts(overrideArguments=None): action='store_const', const='::', dest='source_address', help='Make all connections via IPv6', ) - network.add_option( - '--skip-http-head', - action='store_const', default=False, dest='skip_http_head', - help='Skip the initial HTTP head request', - ) - geo = optparse.OptionGroup(parser, 'Geo Restriction') From 00c7c68bf744b7e3c4caa3f64e251b63645fb81a Mon Sep 17 00:00:00 2001 From: Barak Tawily Date: Fri, 23 Nov 2018 22:49:35 +0200 Subject: [PATCH 6/6] Update options.py --- youtube_dl/options.py | 1 - 1 file changed, 1 deletion(-) diff --git a/youtube_dl/options.py b/youtube_dl/options.py index e7dea1172..af9ba1adb 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -232,7 +232,6 @@ def parseOpts(overrideArguments=None): help='Make all connections via IPv6', ) - geo = optparse.OptionGroup(parser, 'Geo Restriction') geo.add_option( '--geo-verification-proxy',