Userscript clips functionality

This commit is contained in:
mphelp committed 2021-12-05 20:52:07 -06:00
1 parent 3bca601e3d
commit 6cba112185
1 file changed
+7 -4
@@ -265,10 +265,13 @@ function setInitialState() {
} }
function getVideoId() { function getVideoId() {
const urlParams = new URLSearchParams(window.location.search); const urlObject = new URL(window.location.href);
const videoId = urlParams.get("v"); const pathname = urlObject.pathname;
if (pathname.startsWith('/clips')) {
return videoId; return document.querySelector("meta[itemprop='videoId']").content;
} else {
return urlObject.searchParams.get("v");
}
} }
function isVideoLoaded() { function isVideoLoaded() {