
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
@plussub/srt-vtt-parser
Advanced tools
A dependency free SRT / Vtt subtitle parser, written in Typescript.
A dependency-free SRT/VTT subtitle parser, written in TypeScript.
npm i @plussub/srt-vtt-parser
import fs from 'fs';
import { parse } from '@plussub/srt-vtt-parser';
const { entries } = parse(
fs
.readFileSync('transcript.vtt') // or '.srt'
.toString()
);
entries.forEach(({ from, to, text, id }) => {
// process transcript entry
});
SRT (SubRip)
00:01:42,821 --> 00:01:44,289
(SIREN WAILING IN DISTANCE)
multiline test
2
00:01:45,365 --> 00:01:48,084
<i>DRIVER: There's 100,000 streets in this city.</i>
3
00:01:49,077 --> 00:01:51,421
You don't need to know the route.
VTT
WEBVTT
1
00:01:42.821 --> 00:01:44.289
(SIREN WAILING IN DISTANCE)
multiline test
2
00:01:45.365 --> 00:01:48.084
<i>DRIVER: There's 100,000 streets in this city.</i>
3
00:01:49.077 --> 00:01:51.421
You don't need to know the route.
Results into
{
"entries": [
{
"from": 102821,
"id": "1",
"text": "(SIREN WAILING IN DISTANCE)\nmultiline test",
"to": 104289
},
{
"from": 105365,
"id": "2",
"text": "<i>DRIVER: There's 100,000 streets in this city.</i>",
"to": 108084
},
{
"from": 109077,
"id": "3",
"text": "You don't need to know the route.",
"to": 111421
}
]
}
Respect NOTE/ MULTILINE NOTE / STYLE Blocks and inline style but will ignore them for the output.
WEBVTT
STYLE
::cue {
background-image: linear-gradient(to bottom, dimgray, lightgray);
color: papayawhip;
}
/* Style blocks cannot use blank lines nor "dash dash greater than" */
NOTE comment blocks can be used between style blocks.
00:01:42.821 --> 00:01:44.289
(SIREN WAILING IN DISTANCE)
multiline test
NOTE style blocks cannot appear after the first cue.
this is a multiline note block
some identifier
00:01:45.365 --> 00:01:48.084
<i>DRIVER: There's 100,000 streets in this city.</i>
00:01:49.077 --> 00:01:51.421
You don't need to know the route.
Results into
{
"entries": [
{
"from": 102821,
"id": "",
"text": "(SIREN WAILING IN DISTANCE)\nmultiline test",
"to": 104289
},
{
"from": 105365,
"id": "some identifier",
"text": "<i>DRIVER: There's 100,000 streets in this city.</i>",
"to": 108084
},
{
"from": 109077,
"id": "",
"text": "You don't need to know the route.",
"to": 111421
}
]
}
FAQs
A dependency free SRT / Vtt subtitle parser, written in Typescript.
We found that @plussub/srt-vtt-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.