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-2.0.1.tar.gz
(8.4 kB
view details)
Built Distribution
File details
Details for the file subtitle_parser-2.0.1.tar.gz
.
File metadata
- Download URL: subtitle_parser-2.0.1.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1215907586c6ffbdbdefd59c0ee4f35026a6dad6cf87908f3f4a70b1bb59e353 |
|
MD5 | 7e89e7903b21a87f07fec949bfdd6f58 |
|
BLAKE2b-256 | 6b4c14a7c8a089c43823562035dd6a3bd5ea633b133d6e230289fe30d10a17b0 |
File details
Details for the file subtitle_parser-2.0.1-py3-none-any.whl
.
File metadata
- Download URL: subtitle_parser-2.0.1-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d903d6f7974ab41849491940e60e284c50c3df7f4d81cd007101e25783ea635 |
|
MD5 | 68a06a4c13f1fb27500379855cf555b7 |
|
BLAKE2b-256 | 650f89de0a2df2d313bf9d8a7598b5a82ba76be23670cf57b8ee813b1516629c |