Open westiti opened 1 year ago
Quick and dirty:
import videoUrlParser from "js-video-url-parser";
videoUrlParser.plugins.youtube.parseVideoUrl = function(url) {
let match = url.match(
/(?:(?:v|vi|be|videos|embed)\/(?!videoseries)|(?:v|ci)=)([\w-]{11})/i
);
if(match) {
return match[1];
}
// match youtube shorts
match = url.match(/youtube.com\/shorts\/([\w-]{11})/i);
if(match) {
return match[1];
}
return undefined;
};
Can you please add support for Youtube shorts? That will be great.