From 36641cc5ecb7dd00e2300715dee00ac4fe653953 Mon Sep 17 00:00:00 2001 From: garret1317 Date: Thu, 20 Nov 2025 12:10:23 +0000 Subject: Fix TOCTOU bug where only one stream was actually downloadable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit because the playlist_url, domain, first_chunk etc gets re-set by the next items in the loop and the fragments_generator() joyously goes ahead and uses those values, because that's what's there and ^it's a generator so i didnt even need to have the separate fragments_generator func anyway sigh.... well fortunately it failed such that it always downloaded wowza stream which is the best one but still sigh... no wonder both formats looked the same in the spectrum analyser lmao i suppose this is TOCTOU https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use i found this while trying to download 24 hours of silence lmao https://radiko.jp/#!/ts/OC1/20251119050000 "OC1", prob means 'original content 1' ※配信期間外です LAWSON SEEDS OF CREATION 配信日:2025年11月23日(日)22:00~23:02 ※配信期間外は無音となります。 LAWSON SEEDS OF CREATIONで放送されなかったJAM’S からメンバーへの質問を特別にオンエアー! あのヒット曲について語る! wowza stream errors but smartstream is fine so it correctly selected the smartstream stream but the frags it tried to dl were from the wowza stream fun --- yt_dlp_plugins/extractor/radiko.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'yt_dlp_plugins/extractor') diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py index 62a2489..58e6c1e 100644 --- a/yt_dlp_plugins/extractor/radiko.py +++ b/yt_dlp_plugins/extractor/radiko.py @@ -321,14 +321,11 @@ class _RadikoBaseIE(InfoExtractor): first_chunk = traverse_obj(m3u8_formats, (..., "url",), get_all=False) # we have this so that we can still return a semi-useful `url` for use in mpv etc - def fragments_generator(_): - return hacks._generate_as_live_fragments( - self, playlist_url, start_at, end_at, domain, auth_headers, first_chunk - ) - m3u8_formats = [{ "format_id": join_nonempty(domain, "chunked"), - "fragments": fragments_generator, + "fragments": hacks._generate_as_live_fragments( + self, playlist_url, start_at, end_at, domain, auth_headers, first_chunk + ), "protocol": "http_dash_segments_generator", "preference": preference, "ext": "m4a", -- cgit v1.2.3-70-g09d2