Skip to main content

🦜 Youtube to Audio by Andrew A Levin

Project description

YouTube Subtitles Fetcher

YouTube Subtitles Fetcher is a command-line tool that retrieves subtitles (with optional translations) from YouTube videos. This tool is ideal for quickly extracting YouTube transcripts with support for multiple languages.

Features

  • Fetches subtitles for a given YouTube video URL
  • Supports translations into a specified language (if available)
  • Command-line interface for easy integration into scripts or workflows

Installation

First, install the package via pip:

pip install ytb2subtitles

Usage

Use the command-line tool to fetch subtitles by providing a YouTube URL and optionally, a language code.

Command-Line Example

To retrieve subtitles from a YouTube video:

ytb2subtitles https://www.youtube.com/watch?v=example_video_id

To retrieve subtitles in a specific language:

ytb2subtitles https://www.youtube.com/watch?v=example_video_id --language en

Code Example

You can also import this tool as a module in your Python code:

from ytb2subtitles import get_subtitles

url = "https://www.youtube.com/watch?v=example_video_id" subtitles = get_subtitles(url, lang="en") print(subtitles)

Command-Line Arguments

•	url (required): The YouTube video URL.
•	--language or --lang (optional): The language code for subtitles (default is the original language).

Requirements

•	Python 3.x
•	pytube
•	youtube-transcript-api

Contributing

We welcome contributions! If you find a bug or have an idea for a feature, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

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

ytb2subtitles-2024.10.27.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

ytb2subtitles-2024.10.27-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file ytb2subtitles-2024.10.27.tar.gz.

File metadata

  • Download URL: ytb2subtitles-2024.10.27.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.10

File hashes

Hashes for ytb2subtitles-2024.10.27.tar.gz
Algorithm Hash digest
SHA256 b824e017615d7be73f97a6d48205b87459312d8a24aeba42c9767736a1e26fae
MD5 2ed308a0c6b185a16962f2c7f1ef5a74
BLAKE2b-256 dbca291b01ddb2b8cef7e2bac9eb3e202388fed7371cabcaa2f63c0d3320c26c

See more details on using hashes here.

File details

Details for the file ytb2subtitles-2024.10.27-py3-none-any.whl.

File metadata

File hashes

Hashes for ytb2subtitles-2024.10.27-py3-none-any.whl
Algorithm Hash digest
SHA256 ff35ab4bfc8a4297a6351cf4f08f83107e022bbff6f856ef8641f11a120b4689
MD5 aa128094a28544559a477fadd65a1f30
BLAKE2b-256 3340a3f20a62e8a7df2078325f360bd3815e93585608d5079003abe4f3c7ba41

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