1.3.1 • Published 2 years ago

yt-xml2srt v1.3.1

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

yt-xml2srt

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

npm package

Installation

npm i -S yt-xml2srt

Or for Yarn users:

yarn add yt-xml2srt

Usage

Using Promises:

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

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

Or you can use async await

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

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

Using it synchronously:

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

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

Tests

npm test
1.3.1

2 years ago

1.3.0

3 years ago

1.2.4

3 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.5

4 years ago

1.0.4

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