From d1f381220daef52460413ccad6cdf18a1b76cafb Mon Sep 17 00:00:00 2001 From: sherl Date: Thu, 20 Nov 2025 17:54:41 +0100 Subject: [PATCH] fix: use exclusively tv player for age-restricted videos also filter out DRC audio --- ythdd_extractor.py | 4 ++-- ythdd_inv_tl.py | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ythdd_extractor.py b/ythdd_extractor.py index e0eed4f..82f6c7c 100644 --- a/ythdd_extractor.py +++ b/ythdd_extractor.py @@ -162,13 +162,13 @@ def extract(url: str, getcomments=False, maxcomments="", manifest_fix=False, use match use_cookies: case "global": ytdl_context['cookiefile'] = ythdd_globals.config['extractor']['cookies_path'] - ytdl_context['extractor_args']['youtube']['player_client'] = ['mweb', 'tv'] + ytdl_context['extractor_args']['youtube']['player_client'] = ['tv'] if not deno_path: print("FATAL ERROR: deno path is required for playback using cookies!") ytdl_context['js_runtimes']['deno']['path'] = deno_path if deno_path else "" case "agegated": ytdl_context['cookiefile'] = ythdd_globals.config['extractor']['age_restricted_cookies_path'] - ytdl_context['extractor_args']['youtube']['player_client'] = ['mweb', 'tv'] + ytdl_context['extractor_args']['youtube']['player_client'] = ['tv'] if not deno_path: print("FATAL ERROR: deno path is required for playback of age-restricted content!") ytdl_context['js_runtimes']['deno']['path'] = deno_path if deno_path else "" diff --git a/ythdd_inv_tl.py b/ythdd_inv_tl.py index 776e962..a432bca 100644 --- a/ythdd_inv_tl.py +++ b/ythdd_inv_tl.py @@ -290,8 +290,11 @@ def videos(data): continue if video_stream["format_id"] == "18": # todo: do this dynamically initial_fstreams_y[int(video_stream["format_id"])] = video_stream - else: + elif video_stream["format_id"].isdigit(): + # filter out DRC audio initial_astreams_y[int(video_stream["format_id"])] = video_stream + else: + continue # format streams for video_stream in wdata_streams["formats"]: @@ -315,7 +318,8 @@ def videos(data): hls_url = safeTraverse(ydata, ["url"], default="ythdd: unable to retrieve stream url") if age_restricted: - adaptive_formats = [{"url": f"http://a/?expire={int(time_start + 5.9 * 60 * 60)}", "itag": "18", "type": "", "clen": "0", "lmt": "", "projectionType": "RECTANGULAR"}] # same as above + if not adaptive_formats: + adaptive_formats = [{"url": f"http://a/?expire={int(time_start + 5.9 * 60 * 60)}", "itag": "18", "type": "", "clen": "0", "lmt": "", "projectionType": "RECTANGULAR"}] # same as above description += " \n(ythdd: this video is age-restricted and thus only available in 360p - itag 18)" description_html += "
(ythdd: this video is age-restricted and thus only available in 360p - itag 18)"