mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
commit
a1c8ecabca
1 changed files with 3 additions and 2 deletions
5
popup.js
5
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue