mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 17:51:24 +01:00
Compare commits
No commits in common. "d644aeb2c344b542284dc3b79eb2223f9b8fc0e2" and "2cd37f9c57b4cba216962f1d22a57151709f473b" have entirely different histories.
d644aeb2c3
...
2cd37f9c57
|
@ -289,11 +289,7 @@ While all the other dependencies are optional, `ffmpeg` and `ffprobe` are highly
|
|||
* [**brotli**](https://github.com/google/brotli)\* or [**brotlicffi**](https://github.com/python-hyper/brotlicffi) - [Brotli](https://en.wikipedia.org/wiki/Brotli) content encoding support. Both licensed under MIT <sup>[1](https://github.com/google/brotli/blob/master/LICENSE) [2](https://github.com/python-hyper/brotlicffi/blob/master/LICENSE) </sup>
|
||||
* [**websockets**](https://github.com/aaugustin/websockets)\* - For downloading over websocket. Licensed under [BSD-3-Clause](https://github.com/aaugustin/websockets/blob/main/LICENSE)
|
||||
* [**requests**](https://github.com/psf/requests)\* - HTTP library. For HTTPS proxy and persistent connections support. Licensed under [Apache-2.0](https://github.com/psf/requests/blob/main/LICENSE)
|
||||
|
||||
#### Impersonation
|
||||
|
||||
The following provide support for impersonating browser requests. This may be required for some sites that employ TLS fingerprinting and other checks.
|
||||
* [**curl_cffi**](https://github.com/yifeikong/curl_cffi)\* (recommended) - Python binding for [curl-impersonate](https://github.com/lwthiker/curl-impersonate). Provides impersonation targets for Chrome, Edge and Safari. Licensed under [MIT](https://github.com/yifeikong/curl_cffi/blob/main/LICENSE)
|
||||
* [**curl_cffi**](https://github.com/yifeikong/curl_cffi)\* - Python binding for [curl-impersonate](https://github.com/lwthiker/curl-impersonate). Provides impersonation support for chrome, edge and safari. Licensed under [MIT](https://github.com/yifeikong/curl_cffi/blob/main/LICENSE)
|
||||
|
||||
|
||||
### Metadata
|
||||
|
|
|
@ -157,7 +157,6 @@ from .utils import (
|
|||
windows_enable_vt_mode,
|
||||
write_json_file,
|
||||
write_string,
|
||||
YoutubeDLError,
|
||||
)
|
||||
from .utils._utils import _YDLLogger
|
||||
from .utils.networking import (
|
||||
|
@ -715,10 +714,9 @@ class YoutubeDL:
|
|||
impersonate_target = self.params.get('impersonate')
|
||||
if impersonate_target is not None:
|
||||
if not self.impersonate_target_available(impersonate_target):
|
||||
raise YoutubeDLError(
|
||||
raise ValueError(
|
||||
f'Impersonate target "{self.params.get("impersonate")}" is not available. '
|
||||
f'Use --list-impersonate-targets to see available targets. '
|
||||
f'You may be missing dependencies required to support this target - check the manual for what dependencies you may need to install.')
|
||||
f'Use --list-impersonate-targets to see available targets.')
|
||||
|
||||
if 'list-formats' in self.params['compat_opts']:
|
||||
self.params['listformats_table'] = False
|
||||
|
@ -4135,9 +4133,8 @@ class YoutubeDL:
|
|||
elif re.match(r'unsupported (?:extensions: impersonate|impersonate target)', ue.msg.lower()):
|
||||
raise RequestError(
|
||||
f'Impersonate target "{req.extensions["impersonate"]}" is not available.'
|
||||
f' See --list-impersonate-targets for available targets.'
|
||||
f' This request requires browser impersonation, however you may be missing dependencies'
|
||||
f' required to support this target. Check the manual for what dependencies you may need to install.')
|
||||
f' required to support this target. See the documentation for more information.')
|
||||
raise
|
||||
except SSLError as e:
|
||||
if 'UNSAFE_LEGACY_RENEGOTIATION_DISABLED' in str(e):
|
||||
|
|
|
@ -997,6 +997,10 @@ def _real_main(argv=None):
|
|||
ydl.to_stdout(
|
||||
render_table(['Client', 'Version', 'OS', 'OS Version', 'Source'], rows)
|
||||
)
|
||||
if not available_targets:
|
||||
ydl.to_stdout('You are missing dependencies for impersonation. See the README for more info.')
|
||||
ydl.to_stdout(
|
||||
'If the above table is missing targets, you may be missing dependencies for impersonation.')
|
||||
return
|
||||
|
||||
if not actual_use:
|
||||
|
|
|
@ -131,6 +131,7 @@ class ImpersonateRequestHandler(RequestHandler, ABC):
|
|||
headers = self._merge_headers(request.headers)
|
||||
if self._get_request_target(request) is not None:
|
||||
# remove all headers present in std_headers
|
||||
headers.pop('User-Agent', None)
|
||||
for header in std_headers:
|
||||
if header in headers and std_headers[header] == headers[header]:
|
||||
headers.pop(header, None)
|
||||
|
|
Loading…
Reference in New Issue
Block a user