Neurotic Programmer Masquerade
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

yt-xml2srt

1.2.0 • Public • Published

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

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');
 
try {
  const srt = await xml2srt.Parse(xmlString);
  /* DO SOMETHING WITH SRT */
} catch (err) {
  console.log(`Error while converting XML to SRT : ${err}`);
}

Tests

npm test

Install

npm i yt-xml2srt

DownloadsWeekly Downloads

8

Version

1.2.0

License

MIT

Unpacked Size

27.5 kB

Total Files

15

Last publish

Collaborators

  • avatar