YouTube Video Parser
Extract publicly available details related to a YouTube video
Installation
> npm install youtube-video-parser --save
OR
> yarn add youtube-video-parser
Usage
//Import library; //Get YouTube video id from urlconst videoId = YouTubeVideo; //Get video details from videoIdconst video = await YouTubeVideo; /* video object will be in the structure{ videoId: string title: string duration: number keywords: Array<string> channelId: string thumbnails: Array<{ url: string width: string height: string type: 'HighRes' | 'Default' | 'Other' }> author: string viewCount: number avgRating: number isLive: boolean caption: { tracks: Array<{ url: string language: { code: string name: string } autoGenerated: boolean rtl: boolean captions(): Promise<Array<{ start: number, duration: number, text: string }>> }> } language: string streamingData: { expiresIn: number formats: Array<{ itag: number url: string mimeType: { type: string codec: string } bitrate: number avgBitrate: number width: number height: number contentLength: number quality: string qualityLabel: string audioQuality: 'Low' | 'Medium' | 'High' audioSampleRate: number duration: number highReplication: boolean }> adaptiveFormats: Array<{ itag: number url: string mimeType: { type: string codec: string } bitrate: number avgBitrate: number width: number height: number contentLength: number quality: string qualityLabel: string audioQuality: 'Low' | 'Medium' | 'High' audioSampleRate: number duration: number highReplication: boolean isVideoOnly: boolean isAudioOnly: boolean fps: number }> }}*/ //Get english language captionsconst captionInfo = videocaptiontracks;const captions = await captionInfo;
Disclaimer
This library is developed for research and educational purpose. Please check YouTube's terms and conditions before using it in production.