aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/yt_dlp_plugins
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2023-09-10 10:53:18 +0100
committergarret <garret@airmail.cc>2023-09-10 10:53:33 +0100
commit15012800ad2049ca7ea3ea0a17fe5f7755d5c268 (patch)
tree73dca61e1ffa9918fce29a4ec58265bab55d9cfb /yt_dlp_plugins
parent5f52aa29e4e74a717f382134a03700c6dd5139cc (diff)
downloadyt-dlp-rajiko-15012800ad2049ca7ea3ea0a17fe5f7755d5c268.tar.gz
yt-dlp-rajiko-15012800ad2049ca7ea3ea0a17fe5f7755d5c268.tar.bz2
yt-dlp-rajiko-15012800ad2049ca7ea3ea0a17fe5f7755d5c268.zip
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.
Diffstat (limited to 'yt_dlp_plugins')
-rwxr-xr-xyt_dlp_plugins/extractor/radiko.py3
-rw-r--r--yt_dlp_plugins/extractor/radiko_time.py8
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):