Skip to main content

A simple wrapper for youtube-transcript-api to get YouTube video transcripts with ease.

Project description

mr-transcript

DOI PyPI Downloads

A convenient wrapper for the youtube-transcript-api library designed to retrieve YouTube video transcripts quickly and reliably.

Key Features

  • Automatic URL Handling: Supports various YouTube link formats, including youtube.com, youtu.be, shorts, and embed.
  • Intelligent Search: The package first looks for manually created transcripts; if they are unavailable, it automatically switches to YouTube's auto-generated ones.
  • Timecodes: Option to add timestamps to each text block.
  • Language List: Quickly retrieve a dictionary of all available languages for a specific video.
  • Type Safety: Full support for type annotations for better development experience.

Installation

Install the package via pip:

pip install mr-transcript

Or using uv:

uv add mr-transcript

Quick Start

from mr_transcript import get_transcript, get_languages

url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

# 1. Check available languages
languages = get_languages(url)
print(f"Available languages: {languages}")

# 2. Retrieve transcript text (e.g., in English)
if "en" in languages:
    text = get_transcript(url, language="en", timecodes=True)
    print(text[:500])  # Prints the first 500 characters

AI Agent Skill

This repository includes a specialized skill for AI agents (like Gemini CLI). It helps the agent provide expert assistance with Python coding, URL parsing, and integrating this library into your projects.

To install the skill, run:

npx skills add BogdanovychA/mr-transcript --skill "mr-transcript"

Function Descriptions

get_transcript(video_id, language, timecodes=False)

Retrieves the full transcript text.

  • video_id: Video ID or a full link.
  • language: Language code (e.g., 'en', 'uk').
  • timecodes: If True, adds the start time to each text block.

get_languages(video_id)

Returns a dictionary of all available languages for the video.

  • Format: {"language_code": "language_name"} (e.g., {"en": "English"}).

Requirements

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

mr_transcript-0.1.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

mr_transcript-0.1.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file mr_transcript-0.1.1.tar.gz.

File metadata

  • Download URL: mr_transcript-0.1.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for mr_transcript-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5af49994a0a1b63466a5db4522eb589e0a3c6b889e2ceee760ff05362525bce1
MD5 8355bcb01ba9ffb5338b80f6ce89aedd
BLAKE2b-256 3cfa016ebcff2e34ae4db8c8ed5055a4cb7e59f1e95d0c034329eadac57af159

See more details on using hashes here.

File details

Details for the file mr_transcript-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mr_transcript-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for mr_transcript-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d590459bce7cd484f7e33014f6374a5a97856be563548f346b90f7d0ca61bb1b
MD5 7f775b631e3f9215fc410c858be5b56a
BLAKE2b-256 dfd312ea6260d6c7bbbd22b89e26bd41272ca49cfaec9ac88e63293ae046f954

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