Fetch youtube user submitted or fallback to auto-generated captions
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Fix: Fix fails for some Id's (#4) Aug 31, 2018
test chore: fix integration test Aug 31, 2018
.babelrc chore: first commit Nov 22, 2017
.eslintrc.js chore: first commit Nov 22, 2017
.flowconfig Fix: Fix fails for some Id's (#4) Aug 31, 2018
.gitignore chore: first commit Nov 22, 2017
CHANGELOG.md chore(release): v1.0.1 Nov 27, 2017
README.md docs(readme): typo Nov 22, 2017
package.json 1.0.3 Aug 31, 2018
yarn.lock Fix: Fix fails for some Id's (#4) Aug 31, 2018

README.md

Youtube Captions scraper

Fetch youtube user submitted or fallback to auto-generated captions

Installation

  • > npm install -S youtube-captions-scraper OR
  • > yarn add youtube-captions-scraper

Usage

// ES6 / TypeScript
import { getSubtitles } from 'youtube-captions-scraper';

getSubtitles({
  videoID: 'XXXXX', // youtube video id
  lang: 'fr' // default: `en`
}).then(captions => {
  console.log(captions);
});

// ES5
var getSubtitles = require('youtube-captions-scraper').getSubtitles;

getSubtitles({
  videoID: 'XXXXX', // youtube video id
  lang: 'fr' // default: `en`
}).then(function(captions) {
  console.log(captions);
});

Captions will be an array of object of this format:

{
  "start": Number,
  "dur": Number,
  "text": String
}