mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-03-23 21:55:11 +01:00
feat: add flag to suppress standard headers
This commit is contained in:
parent
ccda63934d
commit
3d85135c02
@ -778,6 +778,7 @@ If you fork the project on GitHub, you can run your fork's [build workflow](.git
|
|||||||
--add-headers FIELD:VALUE Specify a custom HTTP header and its value,
|
--add-headers FIELD:VALUE Specify a custom HTTP header and its value,
|
||||||
separated by a colon ":". You can use this
|
separated by a colon ":". You can use this
|
||||||
option multiple times
|
option multiple times
|
||||||
|
--no-std-headers Suppress standard headers
|
||||||
--bidi-workaround Work around terminals that lack
|
--bidi-workaround Work around terminals that lack
|
||||||
bidirectional text support. Requires bidiv
|
bidirectional text support. Requires bidiv
|
||||||
or fribidi executable in PATH
|
or fribidi executable in PATH
|
||||||
|
@ -351,6 +351,7 @@ class YoutubeDL:
|
|||||||
(Only supported by some extractors)
|
(Only supported by some extractors)
|
||||||
enable_file_urls: Enable file:// URLs. This is disabled by default for security reasons.
|
enable_file_urls: Enable file:// URLs. This is disabled by default for security reasons.
|
||||||
http_headers: A dictionary of custom headers to be used for all requests
|
http_headers: A dictionary of custom headers to be used for all requests
|
||||||
|
no_std_headers: Suppress standard headers
|
||||||
proxy: URL of the proxy server to use
|
proxy: URL of the proxy server to use
|
||||||
geo_verification_proxy: URL of the proxy to use for IP address verification
|
geo_verification_proxy: URL of the proxy to use for IP address verification
|
||||||
on geo-restricted sites.
|
on geo-restricted sites.
|
||||||
@ -715,7 +716,8 @@ class YoutubeDL:
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
self.params['compat_opts'] = set(self.params.get('compat_opts', ()))
|
self.params['compat_opts'] = set(self.params.get('compat_opts', ()))
|
||||||
self.params['http_headers'] = HTTPHeaderDict(std_headers, self.params.get('http_headers'))
|
headers = HTTPHeaderDict({}) if self.params.get('no_std_headers') else std_headers
|
||||||
|
self.params['http_headers'] = HTTPHeaderDict(headers, self.params.get('http_headers'))
|
||||||
self._load_cookies(self.params['http_headers'].get('Cookie')) # compat
|
self._load_cookies(self.params['http_headers'].get('Cookie')) # compat
|
||||||
self.params['http_headers'].pop('Cookie', None)
|
self.params['http_headers'].pop('Cookie', None)
|
||||||
|
|
||||||
|
@ -914,6 +914,7 @@ def parse_options(argv=None):
|
|||||||
'prefer_insecure': opts.prefer_insecure,
|
'prefer_insecure': opts.prefer_insecure,
|
||||||
'enable_file_urls': opts.enable_file_urls,
|
'enable_file_urls': opts.enable_file_urls,
|
||||||
'http_headers': opts.headers,
|
'http_headers': opts.headers,
|
||||||
|
'no_std_headers': opts.no_std_headers,
|
||||||
'proxy': opts.proxy,
|
'proxy': opts.proxy,
|
||||||
'socket_timeout': opts.socket_timeout,
|
'socket_timeout': opts.socket_timeout,
|
||||||
'bidi_workaround': opts.bidi_workaround,
|
'bidi_workaround': opts.bidi_workaround,
|
||||||
|
@ -1115,6 +1115,11 @@ def create_parser():
|
|||||||
callback_kwargs={'multiple_keys': False},
|
callback_kwargs={'multiple_keys': False},
|
||||||
help='Specify a custom HTTP header and its value, separated by a colon ":". You can use this option multiple times',
|
help='Specify a custom HTTP header and its value, separated by a colon ":". You can use this option multiple times',
|
||||||
)
|
)
|
||||||
|
workarounds.add_option(
|
||||||
|
'--no-std-headers',
|
||||||
|
action='store_true', dest='no_std_headers', default=False,
|
||||||
|
help='Suppress standard headers',
|
||||||
|
)
|
||||||
workarounds.add_option(
|
workarounds.add_option(
|
||||||
'--bidi-workaround',
|
'--bidi-workaround',
|
||||||
dest='bidi_workaround', action='store_true',
|
dest='bidi_workaround', action='store_true',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user