Repository
Current version released
4 years ago
Neta
A SRT and ASS/SSA subtitle parser for Deno.
Usage
import { srtToText } from 'https://deno.land/x/neta/mod.ts';
const srt = await Deno.readTextFile('./test.srt');
const text = srtToText(srt);
await Deno.writeTextFile('./subtitle.txt', text);
Becuase APIs are not stable enough now, I recommend that you specify the version when you import Neta. like this:
import { srtToText } from 'https://deno.land/x/neta@v0.1.0/mod.ts';
API
- SRT
srtParser()
Converts srt subtitles into array of objectssrtToText()
extract text from srt subtitle
- ASS/SSA
assParser()
Converts ASSString to JSONassToSrt()
Convert ASS to SRTassToText()
Convert ASS to plain text
Example
const srtString = `1
00:00:00,001 --> 00:00:00,002
Five men is a juicy opportunity.
One man is a waste of ammo.
2
00:00:00,100 --> 00:00:00,200
Keep the sand out of your weapons!`;
const ast = srtParser(srtString);
console.log(ast);