A minimal client for the hosted YouTube-to-Text transcription API.
⚠️ Package currently in development. In the meantime, access the API at youtubetotext.com/api
- Simple, lightweight wrapper written in Python
- Supports fetching transcripts with language fallbacks
- Handles HTTP errors and returns JSON responses
pip install youtubetotext-sdk
from youtubetotext.client import YouTubeToText
client = YouTubeToText(api_key="YOUR_API_KEY")
response = client.transcript("VIDEO_ID", lang="es,fr")
for segment in response["segments"]:
print(segment["text"])
YouTubeToText.transcript(video_id: str, lang: str = None) -> dict
- video_id: YouTube video identifier (e.g.
4t2714aREe0
) - lang: Optional comma‑separated ISO language codes (
en
,ko,ja
, etc.) - Returns: A dictionary with the following keys:
source
(str): Which backend provided the transcript (youtube-transcript-api
,yt-dlp
,whisper-cpp
)language
(str): Human‑readable language (e.g. "English")language_code
(str): ISO code (e.g.en
)is_generated
(bool): Whether the transcript was auto‑generatedsegments
(List[dict]): List of segment objects:start
(float): Start time in secondsduration
(float): Duration in secondstext
(str): Transcript text
Full API docs at: https://youtubetotext.com/
Set your API key via the YTT_API_KEY
environment variable:
export YTT_API_KEY="your_api_key"
See examples/python_example.py
and examples/js_example.js
in this repo.
Bug reports and pull requests are welcome at https://github.com/in-c0/youtubetotext-sdk.
This project is licensed under the MIT License. See the LICENSE file for details.