From 15012800ad2049ca7ea3ea0a17fe5f7755d5c268 Mon Sep 17 00:00:00 2001 From: garret Date: Sun, 10 Sep 2023 10:53:18 +0100 Subject: check end of broadcast day, not end of air time The old behaviour assumed programmes were deleted precisely a week after their end time. This isn't actually the case though, as long as it's within a week of the _broadcast day_, the site will let you. This lead to the extractor bailing out (Programme is no longer available) when in fact the programme was still playable on the site. The fix uses the same logic as RadikoTime.broadcast_day to find the broadcast day (TODO: one func for both?), then sets the time to 05:00:00 the next day - i.e. the start of a new broadcast day. --- yt_dlp_plugins/extractor/radiko_time.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'yt_dlp_plugins/extractor/radiko_time.py') diff --git a/yt_dlp_plugins/extractor/radiko_time.py b/yt_dlp_plugins/extractor/radiko_time.py index 441085e..be7f6cd 100644 --- a/yt_dlp_plugins/extractor/radiko_time.py +++ b/yt_dlp_plugins/extractor/radiko_time.py @@ -20,6 +20,14 @@ class RadikoTime(): dt -= datetime.timedelta(days=1) return dt.strftime("%Y%m%d") + def broadcast_day_end(self): + dt = self.datetime + if dt.hour < 5: + dt -= datetime.timedelta(days=1) + dt += datetime.timedelta(days=1) + dt.replace(hour=5, minute=0, second=0) + return dt + def timestamp(self): return self.datetime.timestamp() def isoformat(self): -- cgit v1.2.3-70-g09d2