aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/yt_dlp_plugins/extractor/radiko.py
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2023-08-15 22:42:51 +0100
committergarret <garret@airmail.cc>2023-08-15 22:45:56 +0100
commit1f25017782f42dafcf1a7612fce8b28fe23ff76c (patch)
treebff0d671495ba73ed6907a8981abc5861e60ff42 /yt_dlp_plugins/extractor/radiko.py
parent7700d64ab8f344c9d4b15d83bfe48b5914bf5461 (diff)
downloadyt-dlp-rajiko-1f25017782f42dafcf1a7612fce8b28fe23ff76c.tar.gz
yt-dlp-rajiko-1f25017782f42dafcf1a7612fce8b28fe23ff76c.tar.bz2
yt-dlp-rajiko-1f25017782f42dafcf1a7612fce8b28fe23ff76c.zip
Add timefree availability check
afaict nhk doesn't have timefree, and it says as much on the programme pages The download doesn't fail though, you just get a loop of elevator music and an apology that it's not available (lasting the duration of the programme) from tsDetail.js tsInNg = playable in the area tsOutNg = playable outside the area (maybe - just a guess really, but seems to line up) outside station area + playable in area + not playable outside = not available in your area outside station area + not playable in area + not playable outside area = not available on timefree inside station area + not playable in area = not available on timefree we'll always be in the station area, so we only have to check tsInNg included a message about NHK Radiru because so far i've only seen NHK programmes be unavailable one day i should make the programme_meta func return a dict or something instead of just adding stuff on the end ad infinitum closes #15
Diffstat (limited to 'yt_dlp_plugins/extractor/radiko.py')
-rwxr-xr-xyt_dlp_plugins/extractor/radiko.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py
index 0078562..2dc7380 100755
--- a/yt_dlp_plugins/extractor/radiko.py
+++ b/yt_dlp_plugins/extractor/radiko.py
@@ -8,6 +8,7 @@ from yt_dlp.extractor.common import InfoExtractor
from yt_dlp.utils import (
OnDemandPagedList,
clean_html,
+ int_or_none,
join_nonempty,
parse_qs,
traverse_obj,
@@ -762,7 +763,7 @@ class RadikoTimeFreeIE(_RadikoBaseIE):
"series": "season_name",
"tags": "tag",
}
- )}, (prog.get("ft"), prog.get("to"))
+ )}, (prog.get("ft"), prog.get("to")), int_or_none(prog.get("ts_in_ng")) != 2
def _extract_chapters(self, station, start, end, video_id=None):
start_str = urllib.parse.quote(start.isoformat())
@@ -782,13 +783,18 @@ class RadikoTimeFreeIE(_RadikoBaseIE):
def _real_extract(self, url):
station, start_time = self._match_valid_url(url).group("station", "id")
- meta, times = self._get_programme_meta(station, start_time)
+ meta, times, available = self._get_programme_meta(station, start_time)
noformats_expected = False
noformats_msg = "No video formats found!"
noformats_force = False
live_status = "was_live"
+ if not available:
+ noformats_force = True
+ noformats_expected = True
+ noformats_msg = "This programme is not available. If this is an NHK station, you may wish to try NHK Radiru."
+
start_datetime = self._timestring_to_datetime(times[0])
end_datetime = self._timestring_to_datetime(times[1])