From b0ae964f2d881235c4d436b8c7c1c3a04c7800f4 Mon Sep 17 00:00:00 2001
From: garret <garret@airmail.cc>
Date: Mon, 5 Aug 2024 09:47:55 +0100
Subject: construct the chapter API url properly (not stringmashing)

---
 yt_dlp_plugins/extractor/radiko.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'yt_dlp_plugins')

diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py
index 12db23b..7d06d37 100644
--- a/yt_dlp_plugins/extractor/radiko.py
+++ b/yt_dlp_plugins/extractor/radiko.py
@@ -468,10 +468,11 @@ class RadikoTimeFreeIE(_RadikoBaseIE):
 					)}, (actual_start, actual_end), int_or_none(prog.get("ts_in_ng")) != 2
 
 	def _extract_chapters(self, station, start, end, video_id=None):
-		start_str = urllib.parse.quote(start.isoformat())
-		end_str = urllib.parse.quote(end.isoformat())
-		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")
+		api_url = update_url_query(f"https://api.radiko.jp/music/api/v1/noas/{station}", {
+			"start_time_gte": start.isoformat(),
+			"end_time_lt": end.isoformat(),
+		})
+		data = self._download_json(api_url, video_id, note="Downloading tracklist").get("data")
 
 		chapters = []
 		for track in data:
-- 
cgit v1.2.3-70-g09d2