比如说,我有一个 vtt 文件,我想从中获取 nodejs 环境中的所有提示及其相关属性,例如 startTime、endTime 等。
我已经搜索了所有我能想到的关键字,比如'parse vtt file by javascript',但结果都是关于mozilla/vtt.js 的。但我不需要与浏览器/窗口交互,它只是一个静态 vtt 文件,我需要通过 JavaScript 从中提取数据。
有人可以给我一些提示吗?谢谢!
示例 vtt 内容:
WEBVTT FILE
1
00:00:03.500 --> 00:00:05.000 D:vertical A:start
Everyone wants the most from life
2
00:00:06.000 --> 00:00:09.000 A:start
Like internet experiences that are rich <b>and</b> entertaining
3
00:00:11.000 --> 00:00:14.000 A:end
Phone conversations where people truly <c.highlight>connect</c>
4
00:00:14.500 --> 00:00:18.000
Your favourite TV programmes ready to watch at the touch of a button
5
00:00:19.000 --> 00:00:24.000
Which is why we are bringing TV, internet and phone together in <c.highlight>one</c> super package
6
00:00:24.500 --> 00:00:26.000
<c.highlight>One</c> simple way to get everything
7
00:00:26.500 --> 00:00:27.500 L:12%
UPC
8
00:00:28.000 --> 00:00:30.000 L:75%
Simply for <u>everyone</u>