DEV Community

Divyansh Agrawal
Divyansh Agrawal

Posted on

How to check if a youtube video is shorts or not using nodejs?

What if I gave you a youtube video id and asked you to tell Me wether the video is shorts or not without opening it?
How Would You do that?
Simple -
Introducing identify-youtube-shorts npm package
It allows you to easily check if a youtube video is youtube shorts or not

Example

const checkIfYoutubeShorts = require('identify-youtube-shorts');
const videoID = "dQw4w9WgXcQ";
async function example(videoID){
    const ifShorts = await checkIfYoutubeShorts(videoID);
    console.log(ifShorts);
}
example(videoID)
Enter fullscreen mode Exit fullscreen mode

It will print whether the youtube video with the id - dQw4w9WgXcQ is a youtube short or not.

Installation

Easy Just use npm i identify-youtube-shorts

Read more about it here - https://www.npmjs.com/package/identify-youtube-shorts

Top comments (0)