Merge pull request #49 from OfficialNoob/patch-6

Old function in-use
This commit is contained in:
Ajay Ramachandran 2019-07-30 14:41:21 -04:00 committed by GitHub
commit a1c8ecabca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}