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

Uploaded Source

Built Distribution

ytb2subtitles-2024.10-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ytb2subtitles-2024.10.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.tar.gz
Algorithm Hash digest
SHA256 23323231c896900c3b3386b86a4cc0db952988ecf80ca0efea7224c75d05b529
MD5 099e112f6f59f896c7f22faab258d6a0
BLAKE2b-256 6dd572ae71ce78ad4483a8eb9bd1cce6b6360396d1013472b540c1db8ff6db20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ytb2subtitles-2024.10-py3-none-any.whl
Algorithm Hash digest
SHA256 7a361687363045f8faeed20e0ad04ffd5a1f281e183ef39e687a6f28d7393202
MD5 5e809753b3113f23d5301b2556abbf52
BLAKE2b-256 e4f377184fe8be14b94def1393552629e4c7d1d5d0cfc432da464866c8059f27

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