mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-07-19 03:51:06 -05:00
[YouTube] Bypass age-gating for certain restricted videos
* Use TVHTML5_SIMPLY_EMBEDDED_PLAYER client * Also add and fix tests * Introduce and use new utility function `update_url()`
This commit is contained in:
@ -4121,6 +4121,17 @@ def update_url_query(url, query):
|
||||
query=compat_urllib_parse_urlencode(qs, True)))
|
||||
|
||||
|
||||
def update_url(url, **kwargs):
|
||||
"""Replace URL components specified by kwargs
|
||||
url: compat_str or parsed URL tuple
|
||||
returns: compat_str"""
|
||||
if not kwargs:
|
||||
return compat_urlparse.urlunparse(url) if isinstance(url, tuple) else url
|
||||
if not isinstance(url, tuple):
|
||||
url = compat_urlparse.urlparse(url)
|
||||
return compat_urlparse.urlunparse(url._replace(**kwargs))
|
||||
|
||||
|
||||
def update_Request(req, url=None, data=None, headers={}, query={}):
|
||||
req_headers = req.headers.copy()
|
||||
req_headers.update(headers)
|
||||
|
Reference in New Issue
Block a user