aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/yt_dlp_plugins/extractor
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp_plugins/extractor')
-rwxr-xr-xyt_dlp_plugins/extractor/radiko.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py
index 8a7ec6d..a36ea37 100755
--- a/yt_dlp_plugins/extractor/radiko.py
+++ b/yt_dlp_plugins/extractor/radiko.py
@@ -767,11 +767,15 @@ class RadikoTimeFreeIE(_RadikoBaseIE):
data = self._download_json(f"https://api.radiko.jp/music/api/v1/noas/{station}?start_time_gte={start_str}&end_time_lt={end_str}",
video_id, note="Downloading tracklist").get("data")
- return self._extract_chapters_helper(data,
- title_function=lambda track: join_nonempty("artist_name", "title", delim=" - ", from_dict=track),
- start_function=lambda track: (datetime.datetime.fromisoformat(track.get("displayed_start_time")) - start).total_seconds(),
- duration=(end - start).total_seconds()
- )
+ chapters = []
+ for track in data:
+ artist = traverse_obj(track, ("artist", "name")) or track.get("artist_name")
+ chapters.append({
+ "title": join_nonempty(artist, track.get("title"), delim=" - "),
+ "start_time": (datetime.datetime.fromisoformat(track.get("displayed_start_time")) - start).total_seconds(),
+ })
+
+ return chapters
def _real_extract(self, url):
station, start_time = self._match_valid_url(url).group("station", "id")