From f5f919dfef7d35dcf94491ec1cf6262725e67a83 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 19 Oct 2023 10:25:10 +0700 Subject: [PATCH] fix video id extraction for url with additional query params --- extension/script.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extension/script.js b/extension/script.js index bcb8b9e..a83c7f8 100644 --- a/extension/script.js +++ b/extension/script.js @@ -274,7 +274,8 @@ function buildChannelDownloadButton() { let urlObj = new URL(currentLocation); if (urlObj.pathname.startsWith('/watch')) { - let videoId = urlObj.search.split('=')[1]; + let params = new URLSearchParams(document.location.search); + let videoId = params.get('v'); channelDownloadButton.setAttribute('data-type', 'video'); channelDownloadButton.setAttribute('data-id', videoId); channelDownloadButton.title = `TA download video: ${videoId}`;