Removed getYouTubeVideoID as in utils

This commit is contained in:
Official Noob
2019-08-04 19:04:43 +01:00
committed by GitHub
parent 64befaebfc
commit e6fa832cb8

View File

@@ -1144,18 +1144,6 @@ function sendRequestToCustomServer(type, fullAddress, callback) {
xmlhttp.send(); xmlhttp.send();
} }
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);
var id = new URL(url).searchParams.get("v");
if (url.includes("/embed/")) {
//it is an embed, don't search for v
id = match[7];
}
return (match && match[7].length == 11) ? id : false;
}
//returns the start time of the video if there was one specified (ex. ?t=5s) //returns the start time of the video if there was one specified (ex. ?t=5s)
function getYouTubeVideoStartTime(url) { function getYouTubeVideoStartTime(url) {
let searchParams = new URL(url).searchParams; let searchParams = new URL(url).searchParams;