aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2019-07-30 14:41:21 -0400
committerGitHub <[email protected]>2019-07-30 14:41:21 -0400
commita1c8ecabca0a9070d26872ea1db0c037da3cf0a7 (patch)
tree33885f5e0271ff0c1e60d310468e1531d08037e1
parentda207095128078457f1805475c4511b8f3c4232b (diff)
parent53f611a43abd5ef5182943a1b71f47c6432f9b6a (diff)
downloadSponsorBlock-a1c8ecabca0a9070d26872ea1db0c037da3cf0a7.tar.gz
SponsorBlock-a1c8ecabca0a9070d26872ea1db0c037da3cf0a7.zip
Merge pull request #49 from OfficialNoob/patch-6
Old function in-use
-rw-r--r--popup.js5
1 files 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;
}