Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Youtube shorts support #112

Open
westiti opened this issue Apr 8, 2023 · 1 comment
Open

[Feature request] Youtube shorts support #112

westiti opened this issue Apr 8, 2023 · 1 comment

Comments

@westiti
Copy link

westiti commented Apr 8, 2023

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

@FoxxMD
Copy link

FoxxMD commented Jul 18, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants