[ie/youtube] Revert 56ea3a00ea

Remove `request_no_ads` workaround (#15214)

Closes #15212
Authored by: bashonly
master
bashonly 3 days ago committed by GitHub
parent 56ea3a00ea
commit 017d76edcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1871,7 +1871,6 @@ The following extractors use this feature:
* `pot_trace`: Enable debug logging for PO Token fetching. Either `true` or `false` (default) * `pot_trace`: Enable debug logging for PO Token fetching. Either `true` or `false` (default)
* `fetch_pot`: Policy to use for fetching a PO Token from providers. One of `always` (always try fetch a PO Token regardless if the client requires one for the given context), `never` (never fetch a PO Token), or `auto` (default; only fetch a PO Token if the client requires one for the given context) * `fetch_pot`: Policy to use for fetching a PO Token from providers. One of `always` (always try fetch a PO Token regardless if the client requires one for the given context), `never` (never fetch a PO Token), or `auto` (default; only fetch a PO Token if the client requires one for the given context)
* `jsc_trace`: Enable debug logging for JS Challenge fetching. Either `true` or `false` (default) * `jsc_trace`: Enable debug logging for JS Challenge fetching. Either `true` or `false` (default)
* `request_no_ads`: Skip preroll ads to eliminate the mandatory wait period before download. Either `true` (the default if unauthenticated) or `false`. The default is `false` when logged-in cookies have been passed to yt-dlp, since `true` will result in a loss of premium formats
#### youtube-ejs #### youtube-ejs
* `jitless`: Run suported Javascript engines in JIT-less mode. Supported runtimes are `deno`, `node` and `bun`. Provides better security at the cost of performance/speed. Do note that `node` and `bun` are still considered unsecure. Either `true` or `false` (default) * `jitless`: Run suported Javascript engines in JIT-less mode. Supported runtimes are `deno`, `node` and `bun`. Provides better security at the cost of performance/speed. Do note that `node` and `bun` are still considered unsecure. Either `true` or `false` (default)

@ -2628,29 +2628,18 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
def _get_checkok_params(): def _get_checkok_params():
return {'contentCheckOk': True, 'racyCheckOk': True} return {'contentCheckOk': True, 'racyCheckOk': True}
def _generate_player_context(self, sts=None): @classmethod
def _generate_player_context(cls, sts=None):
context = { context = {
'html5Preference': 'HTML5_PREF_WANTS', 'html5Preference': 'HTML5_PREF_WANTS',
} }
if sts is not None: if sts is not None:
context['signatureTimestamp'] = sts context['signatureTimestamp'] = sts
playback_context = {
'contentPlaybackContext': context,
}
# The 'adPlaybackContext'/'request_no_ads' workaround results in a loss of premium formats.
# Only default to 'true' if the user is unauthenticated, since we can't reliably detect all
# types of premium accounts (e.g. YTMusic Premium), and since premium users don't have ads.
default_arg_value = 'false' if self.is_authenticated else 'true'
if self._configuration_arg('request_no_ads', [default_arg_value])[0] != 'false':
playback_context['adPlaybackContext'] = {
'pyv': True,
}
return { return {
'playbackContext': playback_context, 'playbackContext': {
**self._get_checkok_params(), 'contentPlaybackContext': context,
},
**cls._get_checkok_params(),
} }
def _get_config_po_token(self, client: str, context: _PoTokenContext): def _get_config_po_token(self, client: str, context: _PoTokenContext):

Loading…
Cancel
Save