aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2023-07-04 05:42:09 +0100
committergarret <garret@airmail.cc>2023-07-04 05:42:09 +0100
commit5ef6d0fb1f38c38ac5a7516e40099dc235926bd3 (patch)
treee4091048d53777b60b9e5a6c5a23498239935517
parentc2aeb311b00feabc8cbd4836a1b0bad6d1e4107b (diff)
downloadyt-dlp-rajiko-5ef6d0fb1f38c38ac5a7516e40099dc235926bd3.tar.gz
yt-dlp-rajiko-5ef6d0fb1f38c38ac5a7516e40099dc235926bd3.tar.bz2
yt-dlp-rajiko-5ef6d0fb1f38c38ac5a7516e40099dc235926bd3.zip
get better artist name in tracklist
-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")