# yt-xml2srt

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

Latest version **1.3.1** (published 2022-10-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install yt-xml2srt
pnpm add yt-xml2srt
yarn add yt-xml2srt
bun add yt-xml2srt
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2022-10-19 |
| First published | 2019-12-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 28.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Aasim-A |
| Maintainers | aasim-a |
| Keywords | youtube, xml, srt, xml2srt, caption, yt-caption, convert, converter, yt |

## Links

- npm: https://www.npmjs.com/package/yt-xml2srt
- Repository: https://github.com/Aasim-A/yt-xml2srt
- Homepage: https://github.com/Aasim-A/yt-xml2srt#readme
- Issues: https://github.com/Aasim-A/yt-xml2srt/issues
- npm.io page: https://npm.io/package/yt-xml2srt

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.3.1 (latest) — 2022-10-19
- 1.3.0 — 2021-01-09
- 1.2.4 — 2020-12-26
- 1.2.3 — 2020-10-27
- 1.2.2 — 2020-08-19
- 1.2.1 — 2020-08-18
- 1.2.0 — 2020-06-13
- 1.1.2 — 2020-06-13
- 1.1.1 — 2020-06-05
- 1.1.0 — 2020-02-16
- 1.0.5 — 2020-02-02
- 1.0.4 — 2020-02-02
- 1.0.3 — 2020-01-09
- 1.0.2 — 2019-12-27
- 1.0.1 — 2019-12-27
- … 1 more at https://npm.io/package/yt-xml2srt/versions

## README

# yt-xml2srt

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

[![npm package](https://nodei.co/npm/yt-xml2srt.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/yt-xml2srt/)

# Installation

```bash
npm i -S yt-xml2srt
```

Or for Yarn users:

```bash
yarn add yt-xml2srt
```

# Usage

## Using Promises:

```js
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

```js
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:

```js
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

```bash
npm test
```

---
_Source: https://npm.io/package/yt-xml2srt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
