mirror of
https://github.com/yt-dlp/yt-dlp
synced 2025-01-18 06:43:06 +01:00
[ie/youtube] Do not use web_creator
as a default client (#12087)
Closes #12085 Authored by: bashonly
This commit is contained in:
parent
a3c0321825
commit
c8541f8b13
2 changed files with 8 additions and 35 deletions
|
@ -1769,7 +1769,7 @@ The following extractors use this feature:
|
||||||
#### youtube
|
#### youtube
|
||||||
* `lang`: Prefer translated metadata (`title`, `description` etc) of this language code (case-sensitive). By default, the video primary language metadata is preferred, with a fallback to `en` translated. See [youtube.py](https://github.com/yt-dlp/yt-dlp/blob/c26f9b991a0681fd3ea548d535919cec1fbbd430/yt_dlp/extractor/youtube.py#L381-L390) for list of supported content language codes
|
* `lang`: Prefer translated metadata (`title`, `description` etc) of this language code (case-sensitive). By default, the video primary language metadata is preferred, with a fallback to `en` translated. See [youtube.py](https://github.com/yt-dlp/yt-dlp/blob/c26f9b991a0681fd3ea548d535919cec1fbbd430/yt_dlp/extractor/youtube.py#L381-L390) for list of supported content language codes
|
||||||
* `skip`: One or more of `hls`, `dash` or `translated_subs` to skip extraction of the m3u8 manifests, dash manifests and [auto-translated subtitles](https://github.com/yt-dlp/yt-dlp/issues/4090#issuecomment-1158102032) respectively
|
* `skip`: One or more of `hls`, `dash` or `translated_subs` to skip extraction of the m3u8 manifests, dash manifests and [auto-translated subtitles](https://github.com/yt-dlp/yt-dlp/issues/4090#issuecomment-1158102032) respectively
|
||||||
* `player_client`: Clients to extract video data from. The main clients are `web`, `ios` and `android`, with variants `_music` and `_creator` (e.g. `ios_creator`); and `mweb`, `android_vr`, `web_safari`, `web_embedded`, `tv` and `tv_embedded` with no variants. By default, `ios,tv` is used, or `web_creator,tv` is used when authenticating with cookies. The `_music` variants are added for `music.youtube.com` URLs. Some clients, such as `web` and `android`, require a `po_token` for their formats to be downloadable. Some clients, such as the `_creator` variants, will only work with authentication. Not all clients support authentication via cookies. You can use `all` to use all the clients, and `default` for the default clients. You can prefix a client with `-` to exclude it, e.g. `youtube:player_client=all,-web`
|
* `player_client`: Clients to extract video data from. The main clients are `web`, `ios` and `android`, with variants `_music` and `_creator` (e.g. `ios_creator`); and `mweb`, `android_vr`, `web_safari`, `web_embedded`, `tv` and `tv_embedded` with no variants. By default, `tv,ios,web` is used, or `tv,web` is used when authenticating with cookies. The `_music` variants may be added for `music.youtube.com` URLs. Some clients, such as `web` and `android`, require a `po_token` for their formats to be downloadable. Some clients, such as the `_creator` variants, will only work with authentication. Not all clients support authentication via cookies. You can use `default` for the default clients, or you can use `all` for all clients (not recommended). You can prefix a client with `-` to exclude it, e.g. `youtube:player_client=default,-ios`
|
||||||
* `player_skip`: Skip some network requests that are generally needed for robust extraction. One or more of `configs` (skip client configs), `webpage` (skip initial webpage), `js` (skip js player). While these options can help reduce the number of requests needed or avoid some rate-limiting, they could cause some issues. See [#860](https://github.com/yt-dlp/yt-dlp/pull/860) for more details
|
* `player_skip`: Skip some network requests that are generally needed for robust extraction. One or more of `configs` (skip client configs), `webpage` (skip initial webpage), `js` (skip js player). While these options can help reduce the number of requests needed or avoid some rate-limiting, they could cause some issues. See [#860](https://github.com/yt-dlp/yt-dlp/pull/860) for more details
|
||||||
* `player_params`: YouTube player parameters to use for player requests. Will overwrite any default ones set by yt-dlp.
|
* `player_params`: YouTube player parameters to use for player requests. Will overwrite any default ones set by yt-dlp.
|
||||||
* `comment_sort`: `top` or `new` (default) - choose comment sorting mode (on YouTube's side)
|
* `comment_sort`: `top` or `new` (default) - choose comment sorting mode (on YouTube's side)
|
||||||
|
|
|
@ -116,6 +116,7 @@ INNERTUBE_CLIENTS = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'INNERTUBE_CONTEXT_CLIENT_NAME': 67,
|
'INNERTUBE_CONTEXT_CLIENT_NAME': 67,
|
||||||
|
'REQUIRE_PO_TOKEN': True,
|
||||||
'SUPPORTS_COOKIES': True,
|
'SUPPORTS_COOKIES': True,
|
||||||
},
|
},
|
||||||
# This client now requires sign-in for every video
|
# This client now requires sign-in for every video
|
||||||
|
@ -127,6 +128,7 @@ INNERTUBE_CLIENTS = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'INNERTUBE_CONTEXT_CLIENT_NAME': 62,
|
'INNERTUBE_CONTEXT_CLIENT_NAME': 62,
|
||||||
|
'REQUIRE_PO_TOKEN': True,
|
||||||
'REQUIRE_AUTH': True,
|
'REQUIRE_AUTH': True,
|
||||||
'SUPPORTS_COOKIES': True,
|
'SUPPORTS_COOKIES': True,
|
||||||
},
|
},
|
||||||
|
@ -211,8 +213,8 @@ INNERTUBE_CLIENTS = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'INNERTUBE_CONTEXT_CLIENT_NAME': 5,
|
'INNERTUBE_CONTEXT_CLIENT_NAME': 5,
|
||||||
'REQUIRE_PO_TOKEN': True,
|
|
||||||
'REQUIRE_JS_PLAYER': False,
|
'REQUIRE_JS_PLAYER': False,
|
||||||
|
'REQUIRE_PO_TOKEN': True,
|
||||||
},
|
},
|
||||||
# This client now requires sign-in for every video
|
# This client now requires sign-in for every video
|
||||||
'ios_music': {
|
'ios_music': {
|
||||||
|
@ -229,6 +231,7 @@ INNERTUBE_CLIENTS = {
|
||||||
},
|
},
|
||||||
'INNERTUBE_CONTEXT_CLIENT_NAME': 26,
|
'INNERTUBE_CONTEXT_CLIENT_NAME': 26,
|
||||||
'REQUIRE_JS_PLAYER': False,
|
'REQUIRE_JS_PLAYER': False,
|
||||||
|
'REQUIRE_PO_TOKEN': True,
|
||||||
'REQUIRE_AUTH': True,
|
'REQUIRE_AUTH': True,
|
||||||
},
|
},
|
||||||
# This client now requires sign-in for every video
|
# This client now requires sign-in for every video
|
||||||
|
@ -246,6 +249,7 @@ INNERTUBE_CLIENTS = {
|
||||||
},
|
},
|
||||||
'INNERTUBE_CONTEXT_CLIENT_NAME': 15,
|
'INNERTUBE_CONTEXT_CLIENT_NAME': 15,
|
||||||
'REQUIRE_JS_PLAYER': False,
|
'REQUIRE_JS_PLAYER': False,
|
||||||
|
'REQUIRE_PO_TOKEN': True,
|
||||||
'REQUIRE_AUTH': True,
|
'REQUIRE_AUTH': True,
|
||||||
},
|
},
|
||||||
# mweb has 'ultralow' formats
|
# mweb has 'ultralow' formats
|
||||||
|
@ -1423,8 +1427,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
'401': {'ext': 'mp4', 'height': 2160, 'format_note': 'DASH video', 'vcodec': 'av01.0.12M.08'},
|
'401': {'ext': 'mp4', 'height': 2160, 'format_note': 'DASH video', 'vcodec': 'av01.0.12M.08'},
|
||||||
}
|
}
|
||||||
_SUBTITLE_FORMATS = ('json3', 'srv1', 'srv2', 'srv3', 'ttml', 'vtt')
|
_SUBTITLE_FORMATS = ('json3', 'srv1', 'srv2', 'srv3', 'ttml', 'vtt')
|
||||||
_DEFAULT_CLIENTS = ('ios', 'tv')
|
_DEFAULT_CLIENTS = ('tv', 'ios', 'web')
|
||||||
_DEFAULT_AUTHED_CLIENTS = ('web_creator', 'tv')
|
_DEFAULT_AUTHED_CLIENTS = ('tv', 'web')
|
||||||
|
|
||||||
_GEO_BYPASS = False
|
_GEO_BYPASS = False
|
||||||
|
|
||||||
|
@ -3960,15 +3964,6 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
if not requested_clients:
|
if not requested_clients:
|
||||||
raise ExtractorError('No player clients have been requested', expected=True)
|
raise ExtractorError('No player clients have been requested', expected=True)
|
||||||
|
|
||||||
if smuggled_data.get('is_music_url') or self.is_music_url(url):
|
|
||||||
for requested_client in requested_clients:
|
|
||||||
_, base_client, variant = _split_innertube_client(requested_client)
|
|
||||||
music_client = f'{base_client}_music' if base_client != 'mweb' else 'web_music'
|
|
||||||
if variant != 'music' and music_client in INNERTUBE_CLIENTS:
|
|
||||||
client_info = INNERTUBE_CLIENTS[music_client]
|
|
||||||
if not client_info['REQUIRE_AUTH'] or (self.is_authenticated and client_info['SUPPORTS_COOKIES']):
|
|
||||||
requested_clients.append(music_client)
|
|
||||||
|
|
||||||
if self.is_authenticated:
|
if self.is_authenticated:
|
||||||
unsupported_clients = [
|
unsupported_clients = [
|
||||||
client for client in requested_clients if not INNERTUBE_CLIENTS[client]['SUPPORTS_COOKIES']
|
client for client in requested_clients if not INNERTUBE_CLIENTS[client]['SUPPORTS_COOKIES']
|
||||||
|
@ -4079,28 +4074,6 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
else:
|
else:
|
||||||
prs.append(pr)
|
prs.append(pr)
|
||||||
|
|
||||||
# web_embedded can work around age-gate and age-verification for some embeddable videos
|
|
||||||
if self._is_agegated(pr) and variant != 'web_embedded':
|
|
||||||
append_client(f'web_embedded.{base_client}')
|
|
||||||
# Unauthenticated users will only get web_embedded client formats if age-gated
|
|
||||||
if self._is_agegated(pr) and not self.is_authenticated:
|
|
||||||
self.to_screen(
|
|
||||||
f'{video_id}: This video is age-restricted; some formats may be missing '
|
|
||||||
f'without authentication. {self._login_hint()}', only_once=True)
|
|
||||||
|
|
||||||
''' This code is pointless while web_creator is in _DEFAULT_AUTHED_CLIENTS
|
|
||||||
# EU countries require age-verification for accounts to access age-restricted videos
|
|
||||||
# If account is not age-verified, _is_agegated() will be truthy for non-embedded clients
|
|
||||||
embedding_is_disabled = variant == 'web_embedded' and self._is_unplayable(pr)
|
|
||||||
if self.is_authenticated and (self._is_agegated(pr) or embedding_is_disabled):
|
|
||||||
self.to_screen(
|
|
||||||
f'{video_id}: This video is age-restricted and YouTube is requiring '
|
|
||||||
'account age-verification; some formats may be missing', only_once=True)
|
|
||||||
# web_creator can work around the age-verification requirement
|
|
||||||
# tv_embedded may(?) still work around age-verification if the video is embeddable
|
|
||||||
append_client('web_creator')
|
|
||||||
'''
|
|
||||||
|
|
||||||
prs.extend(deprioritized_prs)
|
prs.extend(deprioritized_prs)
|
||||||
|
|
||||||
if skipped_clients:
|
if skipped_clients:
|
||||||
|
|
Loading…
Add table
Reference in a new issue