mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 21:47:06 +03:00
Merge pull request #37 from OfficialNoob/patch-5
getYouTubeVideoID Better ID Parser
This commit is contained in:
@@ -676,5 +676,6 @@ function sendRequestToCustomServer(type, fullAddress, callback) {
|
|||||||
function getYouTubeVideoID(url) { // Returns with video id else returns false
|
function getYouTubeVideoID(url) { // Returns with video id else returns false
|
||||||
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
|
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
|
||||||
var match = url.match(regExp);
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user