diff options
Diffstat (limited to 'yt_dlp_plugins')
-rwxr-xr-x | yt_dlp_plugins/extractor/radiko.py | 3 | ||||
-rw-r--r-- | yt_dlp_plugins/extractor/radiko_time.py | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py index 7498a91..d035cfd 100755 --- a/yt_dlp_plugins/extractor/radiko.py +++ b/yt_dlp_plugins/extractor/radiko.py @@ -783,10 +783,11 @@ class RadikoTimeFreeIE(_RadikoBaseIE): start = times[0] end = times[1] + end_day = end.broadcast_day_end() now = datetime.datetime.now(tz=rtime.JST) - if end < now - datetime.timedelta(days=7): + if end_day < now - datetime.timedelta(days=7): self.raise_no_formats("Programme is no longer available.", video_id=meta["id"], expected=True) elif start > now: self.raise_no_formats("Programme has not aired yet.", video_id=meta["id"], expected=True) 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): |