From c1bccb5ef6b89f99aeeae25010a17d70a4b28afa Mon Sep 17 00:00:00 2001 From: garret Date: Tue, 13 Jun 2023 02:15:38 +0100 Subject: handle 29-hour time in ShareIE --- yt_dlp_plugins/extractor/radiko.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'yt_dlp_plugins') diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py index cb7a870..4e7d0e2 100755 --- a/yt_dlp_plugins/extractor/radiko.py +++ b/yt_dlp_plugins/extractor/radiko.py @@ -846,4 +846,14 @@ class RadikoShareIE(_RadikoBaseIE): station = traverse_obj(queries, ("sid", 0)) time = traverse_obj(queries, ("t", 0)) + hour = int(time[8:10]) + if hour <= 24: # 29-hour time is valid here, see _unfuck_day in RadikoTimeFreeIE + hour = hour - 24 # move back by a day + + date = datetime.datetime(int(time[:4]), int(time[4:6]), int(time[6:8]), + hour=hour, minute=int(time[10:12]), second=int(time[12:14])) + + date += datetime.timedelta(days=1) # move forward a day in datetime to compensate + time = date.strftime("%Y%m%d%H%M%S") + return self.url_result(f"https://radiko.jp/#!/ts/{station}/{time}", RadikoTimeFreeIE) -- cgit v1.2.3-70-g09d2