diff options
author | garret1317 <garret@airmail.cc> | 2025-05-24 19:28:00 +0100 |
---|---|---|
committer | garret1317 <garret@airmail.cc> | 2025-05-24 19:28:00 +0100 |
commit | a659b48a20b6241a68fc046c86c9ad0f71c9bd86 (patch) | |
tree | c8a43e0bae69d9169dbab65751266e21044a56eb | |
parent | f857c544a0d1c56d3d5b7a05e18afd44a34ed17d (diff) | |
download | yt-dlp-rajiko-a659b48a20b6241a68fc046c86c9ad0f71c9bd86.tar.gz yt-dlp-rajiko-a659b48a20b6241a68fc046c86c9ad0f71c9bd86.tar.bz2 yt-dlp-rajiko-a659b48a20b6241a68fc046c86c9ad0f71c9bd86.zip |
make SearchIE return an id in advance, for download archives
to prevent un-needed extractions when somethings in the archive already
absolutely kicking myself that it was this simple and i only just did it
-rw-r--r-- | yt_dlp_plugins/extractor/radiko.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py index 5f22451..8f84bd7 100644 --- a/yt_dlp_plugins/extractor/radiko.py +++ b/yt_dlp_plugins/extractor/radiko.py @@ -619,15 +619,25 @@ class RadikoSearchIE(InfoExtractor): }] def _strip_date(self, date): + # lazy way of making a timestring (from eg 2025-05-20 01:00:00) return date.replace(" ", "").replace("-", "").replace(":", "") def _pagefunc(self, url, idx): url = update_url_query(url, {"page_idx": idx}) data = self._download_json(url, None, note=f"Downloading page {idx+1}") - return [self.url_result("https://radiko.jp/#!/ts/{station}/{time}".format( - station = i.get("station_id"), time = self._strip_date(i.get("start_time")))) - for i in data.get("data")] + results = [] + for r in data.get("data"): + station = r.get("station_id") + timestring = self._strip_date(r.get("start_time")) + + results.append( + self.url_result( + f"https://radiko.jp/#!/ts/{station}/{timestring}", + id=join_nonempty(station, timestring) + ) + ) + return results def _real_extract(self, url): url = url.replace("/#!/", "/!/", 1) |