get-youtube-chapters
parse chapters from a youtube video description
Last updated 5 months ago by goto-bus-stop .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install get-youtube-chapters 
SYNC missed versions from official npm registry.

get-youtube-chapters

parse chapters from a youtube video description

Install - Usage - License: Apache-2.0

npm travis standard

YouTube now parses "chapters" from video descriptions like this:

screenshot

This package aims to implement more-or-less similar parsing so you can figure out which chapters a video has on your own.

Install

npm install get-youtube-chapters

Usage

Pass in a description string:

var youtubeChapters = require('get-youtube-chapters')
var chapters = youtubeChapters(`
This is a sample description for a video with a track listing!

0:00 Intro
1:36 BOCA
4:44 Break the wall
8:29 Can't get you out of my mind
12:09 Dear
15:55 BOCA (Inst.)
`)

assert.deepStrictEqual(chapters, [
  { start: 0, title: 'Intro' },
  { start: 96, title: 'BOCA' },
  { start: 284, title: 'Break the wall' },
  { start: 509, title: "Can't get you out of my mind" },
  { start: 729, title: 'Dear' },
  { start: 955, title: 'BOCA (Inst.)' }
])

The return value is an array of { start, title } objects. start is the start time in seconds. Chapters run until the start of the next chapter, or the end of the video.

This package can be a little more loose than YouTube itself is. This can be useful if you want to support eg. older album uploads that do not quite follow the chapter format. To do so, set extended: true:

var chapters = youtubeChapters(description, {
  extended: true
})

By default, extended parsing is disabled.

License

Apache-2.0

Current Tags

  • 1.0.0                                ...           latest (5 months ago)

1 Versions

  • 1.0.0                                ...           5 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (0)
None
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |