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.0.1.tar.gz
(5.3 kB
view details)
Built Distribution
File details
Details for the file subtitle-parser-1.0.1.tar.gz
.
File metadata
- Download URL: subtitle-parser-1.0.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb8467cc5d08e0f199d30d37d23d917665de50a40080ae37307a6962dbe19575 |
|
MD5 | 717e76622911a49d122d7e7ddab96c95 |
|
BLAKE2b-256 | 44a2116bde2848518d7b63ef165f6d22f8b3f6f7d6c6f0d2236e9f6eac0eb719 |
File details
Details for the file subtitle_parser-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: subtitle_parser-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c272e8645a6be0ee4c3c743a6f0d7d0b6520712af8922c13e915c0d9bc42355f |
|
MD5 | 9c873413508a37f89086b45684e4b197 |
|
BLAKE2b-256 | 428370254b28cfc27c9cab0162dbec0d516e48beacb3935959e336bf8faf3162 |