Skip to main content

Download YouTube videos, generate and translate subtitles

Project description

yt-srt-gen

yt-srt-gen is a Python tool for downloading YouTube videos, generating subtitles using OpenAI Whisper, and translating them into another language (e.g., English) automatically.

Features

  • Download YouTube videos using yt-dlp.
  • Generate subtitles with OpenAI Whisper.
  • Translate subtitles to a target language using googletrans.
  • Supports multiple subtitle formats: srt, vtt, txt, tsv, json.

Installation

You can install yt-srt-gen via pip:

pip install git+https://github.com/fertkir/yt-srt-gen.git

Or clone the repository and install manually:

git clone https://github.com/fertkir/yt-srt-gen.git
cd yt-srt-gen
pip install .

Usage

yt-srt-gen <YouTube URL> [OPTIONS]

Arguments

  • <YouTube URL>: URL of the YouTube video.

Options

  • --source-language, -s: Language spoken in the audio.
  • --target-language, -t: Language for translated subtitles.
  • --output-format, -f: Subtitle output format (txt, vtt, srt, tsv, json, all, default: srt).
  • --whisper-args, -w: Additional arguments to pass to openai-whisper.

Examples

yt-srt-gen https://www.youtube.com/watch?v=dQw4w9WgXcQ --source-language es --target-language en --output-format srt
yt-srt-gen https://www.youtube.com/watch?v=dQw4w9WgXcQ -s sr -t en -w "--model small --fp16 False"

This will download the video, generate Spanish subtitles, and append English translations.

Dependencies

  • yt-dlp - for downloading YouTube videos.
  • openai-whisper - for automatic subtitle generation.
  • googletrans - for translating subtitles.
  • tqdm - for showing progress bars.

License

This project is licensed under the GPL-3.0-or-later license.

Author

Kirill Fertikov — kirill.fertikov@gmail.com

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

yt_srt_gen-0.1.7.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yt_srt_gen-0.1.7-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file yt_srt_gen-0.1.7.tar.gz.

File metadata

  • Download URL: yt_srt_gen-0.1.7.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yt_srt_gen-0.1.7.tar.gz
Algorithm Hash digest
SHA256 5c8d20e4cedacb106a9822940dfbc69d9c3c1068d589aec8ef5c5149dcaf0443
MD5 e9eb1cd72c60acb6427f0ed168d74911
BLAKE2b-256 c86aede967d0dfeadffd379bd7ca859d6e954ffb35b2fee88b87402519bda477

See more details on using hashes here.

File details

Details for the file yt_srt_gen-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: yt_srt_gen-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yt_srt_gen-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b5e214f5a62f50ba6bddf002aa70347d42db42f9295cfa4901a6e4238da8e5da
MD5 f987639849ad8a6c2eae456f7396db21
BLAKE2b-256 0319317a685c19956c3b3c148c9c0aa1be2d83a36a3cf42897ec57fe698f96ea

See more details on using hashes here.

Supported by

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