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/yourusername/yt-srt-gen.git

Or clone the repository and install manually:

git clone https://github.com/yourusername/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

  • --ydl-format: Format for yt-dlp (default: bestvideo+bestaudio/best).
  • --model: Whisper model to use (default: turbo).
  • --device: Device for Whisper (cpu or cuda, default: cpu).
  • --source-language: Language spoken in the audio (default: sr).
  • --target-language: Language for translated subtitles (default: en).
  • --output-format, -f: Subtitle output format (txt, vtt, srt, tsv, json, all, default: srt).

Example

yt-srt-gen https://www.youtube.com/watch?v=dQw4w9WgXcQ --source-language es --target-language en --output-format srt

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.0.tar.gz (15.8 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.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yt_srt_gen-0.1.0.tar.gz
  • Upload date:
  • Size: 15.8 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.0.tar.gz
Algorithm Hash digest
SHA256 c623c9d62d56c19f52991a3a4fc576c29fe2737a8fa4726ddde45ca8e3487480
MD5 ccc90c2a52f353f71cc4901ccd1c5d5d
BLAKE2b-256 7d1318015cd92dc38b3822ad39cce6dcdd0649bab04a85cfe2172e1df44d25a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yt_srt_gen-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 155892a0a4c454166ff41cb7b19a40d1c43f2a13abdea058f96da794dc87a764
MD5 8c6caecde0842ab744b622844a08516e
BLAKE2b-256 657f0aa4c0455f4ac49ff0b650c00584d0fd946be8f98c0e838f8b19ac95744f

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