0.0.2-development • Published 2 years ago

yt-get-info v0.0.2-development

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

yt-get-info

Get youtube video information

Uses the 'ytInitialPlayerResponse' client side variable.


Install

npm install yt-get-info

Usage

import { getVideoInfo } from "yt-get-info";

getVideoInfo("nSnLpFYLgDU").then(data => {
    // see VideoDetails object
    const { title, author, channelId, viewCount, keywords, shortDescription } = data.videoDetails;

    // See CaptionTracks object
    const captionsTrackList = data.captions.playerCaptionsTracklistRenderer;
    const { captionTracks, audioTracks } = captionsTrackList;

    // See PlayerMicroformatRenderer object
    const additionnalDetails = data.microformat.playerMicroformatRenderer;
    const { category, description, lengthSeconds, publishDate, ownerChannelName, thumbnail, isFamilySafe } = additionnalDetails;
}
);

API

getVideoInfo(videoId : string) : VideoInfo