jsVideoUrlParser icon indicating copy to clipboard operation
jsVideoUrlParser copied to clipboard

[Feature request] Youtube shorts support

Open westiti opened this issue 2 years ago • 1 comments

Can you please add support for Youtube shorts? That will be great.

westiti avatar Apr 08 '23 12:04 westiti

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

FoxxMD avatar Jul 18 '23 21:07 FoxxMD