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.0.tar.gz
(8.3 kB
view details)
Built Distribution
File details
Details for the file subtitle_parser-2.0.0.tar.gz
.
File metadata
- Download URL: subtitle_parser-2.0.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2bca683b918173727434cb659422080909172b71317dc2df5f645744aced267 |
|
MD5 | 13f97d9aaf5c6de41cc42863b7c99de5 |
|
BLAKE2b-256 | af60aa217e70a1538e0628fb820cff358b2269be9c776bd5a6518f60a2de7a16 |
File details
Details for the file subtitle_parser-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: subtitle_parser-2.0.0-py3-none-any.whl
- Upload date:
- Size: 8.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 | 47c9c2ac37752809aa6822832090065adbf9c86da4b69874b11e70ff0799312f |
|
MD5 | e10a7094241659dd10b4ebcee6ddf0e6 |
|
BLAKE2b-256 | 754afbe12bb266024a38211757d2fd88c145466bbb92be68d9341aadb3e5ee38 |