fix: use exclusively tv player for age-restricted videos
also filter out DRC audio
This commit is contained in:
@@ -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 ""
|
||||
|
||||
@@ -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 += "<br/>(ythdd: this video is age-restricted and thus only available in 360p - itag 18)"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user