From 71a24a4870645ac68cc11d665d01e6bd607bf8b9 Mon Sep 17 00:00:00 2001 From: sherl Date: Wed, 8 Jan 2025 14:58:04 +0100 Subject: [PATCH] check if the format with best bitrate is a video --- ythdd_inv_tl.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ythdd_inv_tl.py b/ythdd_inv_tl.py index b8c4bfe..c23976c 100644 --- a/ythdd_inv_tl.py +++ b/ythdd_inv_tl.py @@ -163,8 +163,8 @@ def rebuildFormats(data): except: pass - # we assume here that a stream with the highest bitrate must be a video stream - if data[x]['averageBitrate'] > data[best_bitrate]['averageBitrate']: + # we assume here that a stream with the highest bitrate must be a video stream- that may not be the case + if data[x]['averageBitrate'] > data[best_bitrate]['averageBitrate'] and isVideo: best_bitrate = x # makes FreeTube work, unfortunately it's a video-only stream @@ -203,6 +203,8 @@ def videos(data): idata = ythdd_extractor.IOSextract(data[3]) wdata = ythdd_extractor.WEBextractSinglePage(data[3]) + #return send(200, {'idata': idata, 'wdata': wdata}) + main_results = idata['stage3']['contents']['twoColumnWatchNextResults'] primary_results = safeTraverse(main_results, ['results', 'results', 'contents']) if primary_results: