From c2eac05e4e512c8d4d139e17a122c1fa10827885 Mon Sep 17 00:00:00 2001 From: garret Date: Mon, 22 May 2023 21:08:59 +0100 Subject: check if url time is between start/end of programme urls in the middle of the programme are valid and do occur in the wild --- yt_dlp_plugins/extractor/radiko.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py index f28a4e6..21f2b2f 100755 --- a/yt_dlp_plugins/extractor/radiko.py +++ b/yt_dlp_plugins/extractor/radiko.py @@ -738,15 +738,16 @@ class RadikoTimeFreeIE(_RadikoBaseIE): 'programs', 'program'), get_all=False) for prog in programmes: - if prog['ft'] == start_time: + if prog['ft'] <= start_time < prog['to']: + actual_start = prog['ft'] if len(prog.get('person')) > 0: cast = [person.get("name") for person in prog.get('person')] else: cast = [prog.get('performer')] return { - 'id': join_nonempty(station_id, start_time), - 'timestamp': unified_timestamp(f'{start_time}+0900'), # hack to account for timezone + 'id': join_nonempty(station_id, actual_start), + 'timestamp': unified_timestamp(f'{actual_start}+0900'), # hack to account for timezone 'release_timestamp': unified_timestamp(f'{prog["to"]}+0900'), 'cast': cast, 'description': clean_html(join_nonempty('summary', 'description', from_dict=prog, delim='\n')), -- cgit v1.2.3-70-g09d2