aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2024-09-17 01:18:09 +0100
committergarret <garret@airmail.cc>2024-09-17 01:18:09 +0100
commite9655881313b9b7ca1e402a82f51bbeed8a81e04 (patch)
tree0610277f14ed75c9bcf739e4a2df05ace454089b
parentb1d5e613cda58eb4503abda367c2770588ad7fe9 (diff)
downloadyt-dlp-rajiko-e9655881313b9b7ca1e402a82f51bbeed8a81e04.tar.gz
yt-dlp-rajiko-e9655881313b9b7ca1e402a82f51bbeed8a81e04.tar.bz2
yt-dlp-rajiko-e9655881313b9b7ca1e402a82f51bbeed8a81e04.zip
prepare for "timefree 30"
https://prtimes.jp/main/html/rd/p/000000032.000007490.html "radiko to launch new service "Timefree 30" this autumn, allows listening to programmes from the past 30 days, no 3-hour time limit" probably can't spoof having the plan, that's fine it might work if you pass cookies of a timefree30 account though, so i'm adapting the time stuff to account for that the plan doesn't exist yet, and i don't know how i would go about detecting it yet, so i'm just hardcoding to False for now
-rw-r--r--yt_dlp_plugins/extractor/radiko.py4
-rwxr-xr-xyt_dlp_plugins/extractor/radiko_time.py11
2 files changed, 13 insertions, 2 deletions
diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py
index caaa020..d12f203 100644
--- a/yt_dlp_plugins/extractor/radiko.py
+++ b/yt_dlp_plugins/extractor/radiko.py
@@ -493,7 +493,7 @@ class RadikoTimeFreeIE(_RadikoBaseIE):
end = times[1]
now = datetime.datetime.now(tz=rtime.JST)
- if end.broadcast_day_end() < now - datetime.timedelta(days=7):
+ if end.expiry(False) < now:
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)
@@ -701,7 +701,7 @@ class RadikoPersonIE(InfoExtractor):
now = rtime.RadikoTime.now(tz=rtime.JST)
- min_start = (now - datetime.timedelta(days=7)).broadcast_day_start()
+ min_start = rtime.earliest_available(False)
# we set the earliest time as the earliest we can get,
# so, the start of the broadcast day 1 week ago
# that way we can get everything we can actually download, including stuff that aired at eg "26:00"
diff --git a/yt_dlp_plugins/extractor/radiko_time.py b/yt_dlp_plugins/extractor/radiko_time.py
index 4d51ce5..b383098 100755
--- a/yt_dlp_plugins/extractor/radiko_time.py
+++ b/yt_dlp_plugins/extractor/radiko_time.py
@@ -36,6 +36,17 @@ class RadikoTime(datetime.datetime):
dt = datetime.datetime(date.year, date.month, date.day, 5, 0, 0, tzinfo=JST)
return dt
+ def expiry(self, tf30):
+ available_days = 30 if tf30 else 7
+ return self.broadcast_day_end() + datetime.timedelta(days=available_days)
+ # IF SOMETHING CHANGES HERE YOU NEED TO UPDATE ↓↓earliest_available↓↓ AS WELL!
+
+
+def earliest_available(tf30):
+ available_days = 30 if tf30 else 7
+ return (RadikoTime.now(tz=JST) - datetime.timedelta(days=available_days)).broadcast_day_start()
+ # IF SOMETHING CHANGES HERE YOU NEED TO UPDATE ↑↑expiry↑↑ AS WELL!
+
class RadikoSiteTime(RadikoTime):