From e8c42021467cb23eade6982a97bf161415b5a4ec Mon Sep 17 00:00:00 2001 From: garret Date: Mon, 5 Aug 2024 09:23:06 +0100 Subject: add extractor arg to filter for "key station only" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Programmes that air on a network of stations have an originating station- a "key" station. e.g. for all night nippon the key station is ニッポン放送 (LFR) radiko's new APIs include a key_station field. I'd only seen such a field in the mobile-web site until now, so I haven't been able do anything with it. But now the PC website's gotten this "persons" API, so I can. this arg is currently only useful for the new "persons" urls, but i suspect it might become more useful as time goes on... example usage: you give the url for the host of a networked show, the default will download from every station (probably not what you want) but if you specify key-station-only, then you get just one download from the originating station i may add a "preference" argument at some point, for if you want it from a specific non-key station, but not right now --- yt_dlp_plugins/extractor/radiko.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py index a9f53f5..85a17c8 100644 --- a/yt_dlp_plugins/extractor/radiko.py +++ b/yt_dlp_plugins/extractor/radiko.py @@ -705,6 +705,9 @@ class RadikoPersonIE(InfoExtractor): def entries(): for episode in person_api.get("data"): + if len(self._configuration_arg("key_station_only", ie_key="rajiko")) > 0: + if episode.get("key_station_id") != episode.get("station_id"): + continue share_url = traverse_obj(episode, ("radiko_url", ("pc", "sp", "android", "ios", "app"), {url_or_none}), get_all=False) -- cgit v1.2.3-70-g09d2