From a659b48a20b6241a68fc046c86c9ad0f71c9bd86 Mon Sep 17 00:00:00 2001 From: garret1317 Date: Sat, 24 May 2025 19:28:00 +0100 Subject: 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 --- yt_dlp_plugins/extractor/radiko.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'yt_dlp_plugins') 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) -- cgit v1.2.3-70-g09d2