aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2019-07-27 17:30:01 -0400
committerGitHub <[email protected]>2019-07-27 17:30:01 -0400
commitb0090a3334f0cdd6f98e7c33e4076afdb668537c (patch)
treecfbb4330a6bca2e254e002d393e514d145145cda
parent30c1b2d91981020f3b0fa50f7a31573b21782c02 (diff)
parent71008319569ba94846257c11558f094f1af68b92 (diff)
downloadSponsorBlock-b0090a3334f0cdd6f98e7c33e4076afdb668537c.tar.gz
SponsorBlock-b0090a3334f0cdd6f98e7c33e4076afdb668537c.zip
Merge pull request #37 from OfficialNoob/patch-5
getYouTubeVideoID Better ID Parser
-rw-r--r--content.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/content.js b/content.js
index 522fb810..6e5d27ef 100644
--- a/content.js
+++ b/content.js
@@ -676,5 +676,6 @@ function sendRequestToCustomServer(type, fullAddress, callback) {
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;
}