From d9a59a1e7fc38f214ca34c7e134f86aeb18ac09a Mon Sep 17 00:00:00 2001 From: garret Date: Fri, 5 Jan 2024 15:34:20 +0000 Subject: support downloading as-live formats closes #18 --- yt_dlp_plugins/extractor/radiko.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py index 8ab8cad..0458b92 100644 --- a/yt_dlp_plugins/extractor/radiko.py +++ b/yt_dlp_plugins/extractor/radiko.py @@ -390,6 +390,9 @@ class _RadikoBaseIE(InfoExtractor): _APP_VERSIONS = ["7.5.0", "7.4.17", "7.4.16", "7.4.15", "7.4.14", "7.4.13", "7.4.12", "7.4.11", "7.4.10", "7.4.9", "7.4.8", "7.4.7", "7.4.6", "7.4.5", "7.4.4", "7.4.3", "7.4.2", "7.4.1", "7.4.0", "7.3.8", "7.3.7", "7.3.6", "7.3.1", "7.3.0", "7.2.11", "7.2.10"] + _TF_DELIVERED_ONDEMAND = ('radiko.jp',) + _TF_DOESNT_WORK_WITH_FFMPEG = ('tf-f-rpaa-radiko.smartstream.ne.jp',) + _region = None _user = None @@ -550,6 +553,13 @@ class _RadikoBaseIE(InfoExtractor): "lsid": self._user, "type": "b", # it is a mystery }) + + # defaults + delivered_live = True + preference = -1 + entry_protocol = 'm3u8' + + domain = urllib.parse.urlparse(playlist_url).netloc if timefree: playlist_url = update_url_query(playlist_url, { "start_at": start_at.timestring(), @@ -557,9 +567,18 @@ class _RadikoBaseIE(InfoExtractor): "end_at": end_at.timestring(), "to": end_at.timestring(), }) - domain = urllib.parse.urlparse(playlist_url).netloc + if domain in self._TF_DOESNT_WORK_WITH_FFMPEG: + self.write_debug(f"skipping {domain} (known not working)") + continue + elif domain in self._TF_DELIVERED_ONDEMAND: + # override the defaults for delivered as on-demand + delivered_live = False + preference = 1 + entry_protocol = None + formats += self._extract_m3u8_formats( playlist_url, station, m3u8_id=domain, fatal=False, headers=auth_data, + live=delivered_live, preference=preference, entry_protocol=entry_protocol, note=f"Downloading m3u8 information from {domain}") return formats -- cgit v1.2.3-70-g09d2