1.2.1 • Published 2 years ago

yt-xml2vtt v1.2.1

Weekly downloads
300
License
MIT
Repository
github
Last release
2 years ago

yt-xml2vtt

A tiny module to easily convert YouTube caption format from XML to VTT with ZERO dependencies.

npm package

Installation

npm i -S yt-xml2vtt

Or for Yarn users:

yarn add yt-xml2vtt

Usage

Using Promises:

const xml2vtt = require('yt-xml2vtt');

xml2vtt.Parse(xmlString)
  .then(vtt => /* DO SOMETHING WITH VTT */)
  .catch(err => console.log(`Error while converting XML to VTT : ${err}`));

Or you can use async await

const xml2vtt = require('yt-xml2vtt');

const vtt = await xml2vtt
  .Parse(xmlString)
  .catch(err => console.log(`Error while converting XML to VTT : ${err}`));
/* DO SOMETHING WITH VTT */

Using it synchronously:

const xml2vtt = require('yt-xml2vtt');

try {
  const vtt = xml2vtt.ParseSync(xmlString);
  /* DO SOMETHING WITH VTT */
} catch (err) {
  console.log(`Error while converting XML to VTT : ${err}`);
}

Tests

npm test
1.2.1

2 years ago

1.2.0

3 years ago

1.1.4

3 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago