Skip to content

olastor/simple-srt-parser

Repository files navigation

simple-srt-parser

Simple SRT parser without dependencies.

import { parseSubtitles } from 'simple-srt-parser';

const srt = `1
00:00:01,000 --> 00:00:04,000
Hello world

2
00:00:05,000 --> 00:00:08,000
This is the second subtitle

`;

const subtitles = parseSubtitles(srt);
// [
//   { index: 1, start: 1, end: 4, text: "Hello world" },
//   { index: 2, start: 5, end: 8, text: "This is the second subtitle" }
// ]

API

  • parseSubtitles(srt: string) - parse srt string to subtitle array

About

A simple SRT parser in Typescript without dependencies.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published