aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/yt_dlp_plugins/extractor/radiko.py
diff options
context:
space:
mode:
authorgarret1317 <garret@airmail.cc>2025-11-06 23:37:22 +0000
committergarret1317 <garret@airmail.cc>2025-11-07 00:18:22 +0000
commitca6531cc800c209533cd9ebea9544e892c2c12e0 (patch)
tree1a105dbf221308bd34d766e19e32a198d4fa1302 /yt_dlp_plugins/extractor/radiko.py
parent92918e2ba1e5c745aff2dcf046c82a3c1f9529af (diff)
downloadyt-dlp-rajiko-ca6531cc800c209533cd9ebea9544e892c2c12e0.tar.gz
yt-dlp-rajiko-ca6531cc800c209533cd9ebea9544e892c2c12e0.tar.bz2
yt-dlp-rajiko-ca6531cc800c209533cd9ebea9544e892c2c12e0.zip
Get the first chunk in advance
so that the returned `url` "works" in mpv etc i can download the first one as part of the normal self._extract_m3u8_formats, and pass the url as the first chunk of my chunking set up then the chunks stuff still works, and i can return an url that will play in mpv ...except that it will be 5 minutes ahead because it's a "live"stream oh well its better than nothing lmao
Diffstat (limited to 'yt_dlp_plugins/extractor/radiko.py')
-rw-r--r--yt_dlp_plugins/extractor/radiko.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py
index 2ec363a..dadde05 100644
--- a/yt_dlp_plugins/extractor/radiko.py
+++ b/yt_dlp_plugins/extractor/radiko.py
@@ -286,6 +286,7 @@ class _RadikoBaseIE(InfoExtractor):
"end_at": end_at.timestring(),
"to": end_at.timestring(),
+ "l": 300,
})
domain = urllib.parse.urlparse(playlist_url).netloc
@@ -308,11 +309,19 @@ class _RadikoBaseIE(InfoExtractor):
auth_headers = auth_data["token"]
+ m3u8_formats = self._extract_m3u8_formats(
+ playlist_url, station, m3u8_id=domain, fatal=False, headers=auth_headers,
+ live=delivered_live, preference=preference, entry_protocol=entry_protocol,
+ note=f"Downloading m3u8 information from {domain}"
+ )
+
if delivered_live and timefree and do_as_live_chunks:
+ first_chunk = traverse_obj(m3u8_formats, (..., "url",), get_all=False)
+
def fragments_generator(_):
return hacks._generate_as_live_fragments(
- self, playlist_url, start_at, end_at, domain, auth_headers
+ self, playlist_url, start_at, end_at, domain, auth_headers, first_chunk
)
m3u8_formats = [{
@@ -324,17 +333,11 @@ class _RadikoBaseIE(InfoExtractor):
"vcodec": "none",
# fallback to live for ffmpeg etc
- "url": playlist_url,
+ "url": first_chunk,
"http_headers": auth_headers,
"is_live": "yesn't",
}]
format_note.append("Chunked")
- else:
-
- m3u8_formats = self._extract_m3u8_formats(
- playlist_url, station, m3u8_id=domain, fatal=False, headers=auth_headers,
- live=delivered_live, preference=preference, entry_protocol=entry_protocol,
- note=f"Downloading m3u8 information from {domain}")
for f in m3u8_formats:
# ffmpeg sends a Range header which some streams reject. here we disable that (and also some icecast header as well)