Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/goto-bus-stop/get-youtube-chapters
parse chapters from a youtube video description
https://github.com/goto-bus-stop/get-youtube-chapters
Last synced: 27 days ago
JSON representation
parse chapters from a youtube video description
- Host: GitHub
- URL: https://github.com/goto-bus-stop/get-youtube-chapters
- Owner: goto-bus-stop
- License: other
- Created: 2020-08-22T15:39:16.000Z (about 4 years ago)
- Default Branch: default
- Last Pushed: 2022-10-09T00:39:44.000Z (about 2 years ago)
- Last Synced: 2024-04-25T18:21:24.746Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 80.1 KB
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# get-youtube-chapters
parse chapters from a youtube video description
[Install](#install) - [Usage](#usage) - [License: Apache-2.0](#license)
[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![standard][standard-image]][standard-url]YouTube now parses "chapters" from video descriptions like this:
![screenshot][screenshot-image]
This package aims to implement more-or-less similar parsing so you can figure
out which chapters a video has on your own.[npm-image]: https://img.shields.io/npm/v/get-youtube-chapters.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/get-youtube-chapters
[travis-image]: https://img.shields.io/travis/com/goto-bus-stop/get-youtube-chapters.svg?style=flat-square
[travis-url]: https://travis-ci.com/goto-bus-stop/get-youtube-chapters
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/standard
[screenshot-image]: ./.github/screenshot.png## Install
```
npm install get-youtube-chapters
```## Usage
Pass in a description string:
```js
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.## License
[Apache-2.0](LICENSE.md)