Skip to main content

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.3.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

subtitle_parser-1.3.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file subtitle_parser-1.3.1.tar.gz.

File metadata

  • Download URL: subtitle_parser-1.3.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for subtitle_parser-1.3.1.tar.gz
Algorithm Hash digest
SHA256 b1019649c7778d3f632a704fcfb91499f0c56967f95c0695ac3031765e1cd119
MD5 9c61b9a688e1f198a1e7ad80bf699080
BLAKE2b-256 f51022e11bed74e5b57b1f8de59f5a57d4b5d3994a1101f3ffb1efd7d6bcb64d

See more details on using hashes here.

File details

Details for the file subtitle_parser-1.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for subtitle_parser-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8f1c04102d2b93be38bc1a7b80a3c9ccfbfdf4a8b5b37f1f574b73f6d29e78ad
MD5 7b2c5b4fcc60d2811b82fb697bbefb6e
BLAKE2b-256 2bbc13eb1cd1a765676eef888b09efc2190d81281b2bc407e64438261834e3cd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page