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

Uploaded Source

Built Distribution

subtitle_parser-1.2.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file subtitle-parser-1.2.0.tar.gz.

File metadata

  • Download URL: subtitle-parser-1.2.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for subtitle-parser-1.2.0.tar.gz
Algorithm Hash digest
SHA256 11a45333c0fffb981912185142ac655f5511cb88bbcd578f65111f4be3add5af
MD5 a2ed0518715c0edefbc4958429ba0da0
BLAKE2b-256 9dc9d80ebe909b0f55b4d66c7df8af40bfb89ee9c7ccd9e07145070c69a1649d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for subtitle_parser-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9293d0ae5f24f41249a39e23162f42f036bfd99543c506b4f3e9790a702a87a0
MD5 c3b0d500e42637cb5725d92469eacf3f
BLAKE2b-256 f0b8729a5ad61bf04e214ec7ccc20152705a0a151fb23803eb9105c1a361211b

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