webvtt-to-json
Convert WebVTT to JSON, optionally removing duplicate lines
Installation
Install this tool using pip:
pip install webvtt-to-json
Usage
To output JSON for a WebVTT file:
webvtt-to-json subtitles.vtt
This will output to standard output. Use -o filename to send it to a specified file.
Subtitles can often include duplicate lines. Add -d or --dedupe to attempt to remove those duplicates from the output:
webvtt-to-json --dedupe subtitles.vtt
Use -s or --single to output single "line" keys instead of a "lines" array.
You can also use:
python -m webvtt_to_json ...
Output
Standard output:
[
{
"start": "00:00:00.000",
"end": "00:00:01.829",
"lines": [
" ",
"my<00:00:00.160><c> career</c><00:00:00.480><c> in</c><00:00:00.640><c> side</c><00:00:00.880><c> projects</c><00:00:01.280><c> and</c><00:00:01.520><c> open</c>"
]
}
]
--dedupe output:
[
{
"start": "00:00:01.829",
"end": "00:00:01.839",
"lines": ["my career in side projects and open"]
}
]
--dedupe --single output:
[
{
"start": "00:00:01.829",
"end": "00:00:01.839",
"line": "my career in side projects and open"
}
]
Development
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd webvtt-to-json
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
Release files for webvtt-to-json 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| webvtt-to-json-0.2.tar.gz | 6.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| webvtt_to_json-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.4 kB
Release files / webvtt-to-json-0.2.tar.gz
| Download URL | webvtt-to-json-0.2.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d0917a0903c6ae18193ecaa74a5ec058356c00b8b0888a411d74508ac330293
|
|
BLAKE2b-256 checksum How to use checksums |
8e50d55c03339299ad8ed5ba931d2278755dcf10ffe9af2f1e99bffb2585fd56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Release files / webvtt_to_json-0.2-py3-none-any.whl
| Download URL | webvtt_to_json-0.2-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28dc9b38318854850e237a28a5350e06a40711e5616b70e86bb37a42bdf0f276
|
|
BLAKE2b-256 checksum How to use checksums |
5ee7dd630a459f8bac81373a5fd0ba706f68be2eff12d6aff3e14cf3a14c9012
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|