A simple wrapper for youtube-transcript-api to get YouTube video transcripts with ease.
Project description
mr-transcript
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, andembed. - 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
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: IfTrue, 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
- Python >= 3.8
- youtube-transcript-api >= 1.2.4
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mr_transcript-0.1.0.tar.gz.
File metadata
- Download URL: mr_transcript-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a5dbe6f9c5cc26bda61e7ce9ba3d3dc139aa758e5af6dc194f0040e94d30180
|
|
| MD5 |
f6d5d6c7ab95e62e25e89e0ceaba5645
|
|
| BLAKE2b-256 |
362c4917129548911c72cbc1d26e732e6f528e8249c2fdb1770ec436b2ecb023
|
File details
Details for the file mr_transcript-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mr_transcript-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa4dc5a8bb431dcb9dc2fd59eacc3b4f967f14ba016efd9e04a812724e1f65a7
|
|
| MD5 |
2fcab7a8f84b9b8246442e2c9bfbc8d3
|
|
| BLAKE2b-256 |
5b7abdc05f88fc8622b17a3c56ae5d0d64444535fa668a6a7bab24c133c32a2b
|