diff options
author | garret1317 <garret@airmail.cc> | 2025-05-17 22:20:20 +0100 |
---|---|---|
committer | garret1317 <garret@airmail.cc> | 2025-05-17 22:21:01 +0100 |
commit | c028c876287e7dbbd3fe7e1350f36c03d84b40f5 (patch) | |
tree | 176739a8027b9eb3b74c6a27f77f8de4253ec51c /yt_dlp_plugins/extractor/radiko.py | |
parent | b879d27a7b4fa15ecb41483c25f762eb5d4cb6fa (diff) | |
download | yt-dlp-rajiko-c028c876287e7dbbd3fe7e1350f36c03d84b40f5.tar.gz yt-dlp-rajiko-c028c876287e7dbbd3fe7e1350f36c03d84b40f5.tar.bz2 yt-dlp-rajiko-c028c876287e7dbbd3fe7e1350f36c03d84b40f5.zip |
add quick-downloading support for as-live formats
closes #24
Diffstat (limited to 'yt_dlp_plugins/extractor/radiko.py')
-rw-r--r-- | yt_dlp_plugins/extractor/radiko.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py index c9d2756..e371878 100644 --- a/yt_dlp_plugins/extractor/radiko.py +++ b/yt_dlp_plugins/extractor/radiko.py @@ -21,6 +21,7 @@ from yt_dlp.utils import ( ) import yt_dlp_plugins.extractor.radiko_time as rtime +import yt_dlp_plugins.extractor.radiko_hacks as hacks class _RadikoBaseIE(InfoExtractor): @@ -287,7 +288,6 @@ class _RadikoBaseIE(InfoExtractor): preference = -1 entry_protocol = 'm3u8' - if domain in self._DOESNT_WORK_WITH_FFMPEG and do_blacklist_streams: self.write_debug(f"skipping {domain} (known not working)") continue @@ -297,10 +297,23 @@ class _RadikoBaseIE(InfoExtractor): preference = 1 entry_protocol = None - formats += self._extract_m3u8_formats( - playlist_url, station, m3u8_id=domain, fatal=False, headers=auth_data["token"], - live=delivered_live, preference=preference, entry_protocol=entry_protocol, - note=f"Downloading m3u8 information from {domain}") + if delivered_live and timefree: + chunks = hacks._generate_as_live_chunks(playlist_url, start_at, end_at) + + formats.append({ + "url": playlist_url, # fallback to live for ffmpeg etc + "format_id": join_nonempty(domain, "chunked"), + "live": False, + "hls_media_playlist_data": hacks._playlist_from_chunks(self, chunks, domain, auth_data["token"]), + "preference": preference, + "ext": "m4a", + }) + else: + + formats += self._extract_m3u8_formats( + playlist_url, station, m3u8_id=domain, fatal=False, headers=auth_data["token"], + live=delivered_live, preference=preference, entry_protocol=entry_protocol, + note=f"Downloading m3u8 information from {domain}") return formats |