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
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.1.0.tar.gz
(5.5 kB
view hashes)
Built Distribution
Close
Hashes for subtitle_parser-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1849ffedbbb8201119e21f5bcf58b5ae3092a301947476c857e733d85ec990ba |
|
MD5 | 8e934028d905902f60ee57ef93489bcd |
|
BLAKE2b-256 | 05d31d41bd514e5b2647c428392dec8de37103753c8a83aa9660ce592c23dbcd |