youtube-parser-enhanced

1.1.5 • Public • Published

youtube-parser

A tool to extract URLs and format info from YouTube page. This is almost based on the node-ytdl-core by @fent and youtube-parser npm package, it just adds the player url and sts to the info returned by the command.

Install

$ npm install -g youtube-parser-enhanced

CLI

Usage:
  $ youtube-parser url [options]

Examples:
  $ youtube-parser-enhanced https://www.youtube.com/watch?v=C_vqnySNhQ0 --container mp4
  $ youtube-parser-enhanced https://youtu.be/C_vqnySNhQ0 --quality medium

Options:
  -h, --help           Print help
  -v, --version        Print version
  -d, --dump           Print the whole metadata (including metadata other than URLs.)
  -q, --quality        List URLs of video with the specified quality {small | medium | large}
  -c, --container      List URLs of video with the specified container format {mp4 | webm | flv | 3gp}
  -e, --encoding       List URLs of video with the specified video encoding {VP8 | H.264 | Sorenson H.283 | MPEG-4 Visual}
  -a, --audioEncoding  List URLs of video with the specified audio encoding {mp3 | aac | vorbis}
  --videoOnly          List URLs of video that consists of only a video track
  --audioOnly          List URLs of video that consists of only an audio track

API

getMetadata

Promise getMetadata(string url)
  • url - 'watch video' page on YouTube.
  • return value - A promise object to resolve with an object containing actual URLs and format info of the page's video.

getURL

Promise getURL(string url, object format)
  • url - 'watch video' page on YouTube.
  • format - Desired format of the video.
  • return value - A promise object to resolve with an array of URL/format info objects that matche the requested format.

Example

var youTubeParser = require('youtube-parser-enhanced');
 
youTubeParser.getMetadata('https://www.youtube.com/watch?v=C_vqnySNhQ0')
.then(
  function (metadata) {
    // Access video info.
    console.log(metadata.keywords);
  }
);
 
youTubeParser.getURL('https://youtu.be/C_vqnySNhQ0', {quality: 'medium', container: 'mp4'})
.then(
  function (urlList) {
    // Access URLs.
    console.log(urlList[0]);
  }
);

Readme

Keywords

none

Package Sidebar

Install

npm i youtube-parser-enhanced

Weekly Downloads

0

Version

1.1.5

License

MIT

Unpacked Size

23.4 kB

Total Files

10

Last publish

Collaborators

  • marf95