Parser for SRT and WebVTT subtitle files
Project description
subtitle-parser
This is a simple Python library for parsing subtitle files in SRT or WebVTT format.
How to use stand-alone?
You can use this as a script to convert subtitles to HTML or CSV.
If you have installed it using pip install subtitle-parser
, use python3 -m subtitle_parser
. If you have cloned this repository or downloaded the file, use python3 subtitle_parser.py
.
Examples:
$ python3 subtitle_parser.py --to csv Zoom_transcript.vtt --output transcript.csv
$ python3 -m subtitle_parser --to html episode.srt --input-charset iso-8859-15 --output dialogue.html
How to use as a library?
import subtitle_parser
with open('some_file.srt', 'r') as input_file:
parser = subtitle_parser.SrtParser(input_file)
parser.parse()
parser.print_warnings()
for subtitle in parser.subtitles:
print(subtitle.text)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
subtitle_parser-1.3.0.tar.gz
(7.4 kB
view details)
Built Distribution
File details
Details for the file subtitle_parser-1.3.0.tar.gz
.
File metadata
- Download URL: subtitle_parser-1.3.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bfbfe1f03970d3170c16f5a177e5dd25743a0e2b7a4c99a8b420adf445b8cee |
|
MD5 | a0309ff3f57c7c98be294557a3a76ab5 |
|
BLAKE2b-256 | 95fbf5d493a850d10d2e0beacb99277efe1b48c32d0e369361e1d27cc5390638 |
File details
Details for the file subtitle_parser-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: subtitle_parser-1.3.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d9e65daa25aa8e3ca9de87f3ac95f1251a1ff96236ae2da7f5e9f68e0e65bac |
|
MD5 | e70b764370fbcd67227bab777751e985 |
|
BLAKE2b-256 | 5d724e48233a0d7d8e9671350deeb37f5603633de2558d126e74433cf77a41ef |