From 53f611a43abd5ef5182943a1b71f47c6432f9b6a Mon Sep 17 00:00:00 2001 From: Official Noob <31563761+OfficialNoob@users.noreply.github.com> Date: Tue, 30 Jul 2019 18:59:06 +0100 Subject: [PATCH] Old function in-use --- popup.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/popup.js b/popup.js index 2e75f971..71aa4e87 100644 --- a/popup.js +++ b/popup.js @@ -919,8 +919,9 @@ function sendRequestToServer(type, address, callback) { xmlhttp.send(); } -function getYouTubeVideoID(url) { // Return video id or false +function getYouTubeVideoID(url) { // Returns with video id else returns false var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; var match = url.match(regExp); - return (match && match[7].length == 11) ? match[7] : false; + var id = new URL(url).searchParams.get("v"); + return (match && match[7].length == 11) ? id : false; }