temporary update to youtube id regex

This commit is contained in:
noumantahir 2022-01-12 21:41:26 +05:00
parent 68a883cf78
commit 645c795453

View File

@ -1,9 +1,9 @@
export default (url) => {
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/;
var regExp = /(?:youtube.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu.be\/)([^"&?/\s]{11})/;
var match = url.match(regExp);
var videoId = (match&&match[7].length==11)? match[7] : false;
var videoId = (match&&match[1].length==11)? match[1] : false;
console.log("Extracting id ", videoId, url);
return videoId;