Metadata-Version: 2.5
Name: transcriptyt
Version: 0.1.1
Summary: Python client for the TranscriptYT YouTube Transcript API: transcripts, batch, search, playlists, summaries.
Project-URL: Homepage, https://transcript-yt.com
Project-URL: Documentation, https://transcript-yt.com/docs
Project-URL: Repository, https://github.com/aaditsshah25/transcriptyt-python
License-Expression: MIT
License-File: LICENSE
Keywords: ai-agents,captions,llm,mcp,rag,requestblocked,subtitles,transcript,youtube,youtube-transcript-api,youtube-transcript-api-alternative
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Video
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: httpx>=0.24
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: respx; extra == 'dev'
Description-Content-Type: text/markdown

# transcriptyt

Python client for the [TranscriptYT](https://transcript-yt.com) YouTube Transcript API. Get any public video's transcript as JSON, text, SRT, VTT, CSV or Markdown, in 150+ languages, with AI transcription when a video has no captions. Requests run through rotating proxies, so they keep working from cloud servers where YouTube blocks direct scraping.

```bash
pip install transcriptyt
```

Get a free API key (100 credits) at [transcript-yt.com/dashboard/keys](https://transcript-yt.com/dashboard/keys).

## Usage

```python
from transcriptyt import TranscriptYT

client = TranscriptYT()  # reads TRANSCRIPTYT_API_KEY, or pass api_key="ts_live_..."

t = client.transcript("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
print(t["title"], t["language"])
print(t["text"])
for seg in t["segments"][:3]:
    print(seg["timestamp"], seg["text"])

# Other formats return a string
srt = client.transcript("dQw4w9WgXcQ", format="srt")

# Translate, or pick a language
client.transcript("dQw4w9WgXcQ", translate_to="es")
client.transcript("dQw4w9WgXcQ", language="de")

# Up to 50 videos per call, or a whole playlist/channel
batch = client.transcripts(["dQw4w9WgXcQ", "jNQXAC9IVRw"], format="text")
batch = client.transcripts(playlist="https://www.youtube.com/@mkbhd", limit=20)
for r in batch["results"]:
    print(r["url"], r["ok"])

# Free endpoints
client.search("python tutorial", limit=10)
client.playlist("https://www.youtube.com/playlist?list=...")
client.languages("dQw4w9WgXcQ")
client.usage()

# AI summary, key points and timestamped notes
client.summary("dQw4w9WgXcQ")
```

### Async

```python
from transcriptyt import AsyncTranscriptYT

async with AsyncTranscriptYT() as client:
    t = await client.transcript("dQw4w9WgXcQ")
```

### Errors

Every non-2xx response raises `TranscriptYTError` with `.code` (e.g. `NO_CAPTIONS`, `VIDEO_UNAVAILABLE`, `RATE_LIMITED`, `OUT_OF_CREDITS`), `.status` and `.message`. Rate-limit and capacity responses (429/503) are retried automatically (`max_retries=2`).

```python
from transcriptyt import TranscriptYTError

try:
    client.transcript("dQw4w9WgXcQ", mode="captions")
except TranscriptYTError as e:
    print(e.code, e.message)
```

## Coming from youtube-transcript-api?

[youtube-transcript-api](https://github.com/jdepoix/youtube-transcript-api) reads captions straight from YouTube, so it raises `RequestBlocked` or `IpBlocked` on AWS, Google Cloud, Vercel, Colab and most other servers, and 1.2 removed `get_transcript`. This client calls the TranscriptYT API instead, which runs the YouTube side on residential proxies and returns the same `text`, `start` and `duration` fields:

```python
# Before
from youtube_transcript_api import YouTubeTranscriptApi
segments = YouTubeTranscriptApi().fetch("dQw4w9WgXcQ", languages=["en"]).to_raw_data()

# After
from transcriptyt import TranscriptYT
segments = TranscriptYT().transcript("dQw4w9WgXcQ", language="en")["segments"]
```

Differences: `language="de"` also matches regional tracks such as `de-DE` (no `NoTranscriptFound`), a missing language is translated from the original, and videos with no captions (`TranscriptsDisabled`) are transcribed with AI instead of failing. Failed requests aren't billed.

Fix guides: [RequestBlocked / IpBlocked](https://transcript-yt.com/blog/youtube-transcript-api-request-blocked), [no attribute get_transcript](https://transcript-yt.com/blog/youtube-transcript-api-get-transcript-attributeerror), [NoTranscriptFound](https://transcript-yt.com/blog/youtube-transcript-api-no-transcript-found), [TranscriptsDisabled](https://transcript-yt.com/blog/youtube-transcript-api-transcripts-disabled), [AWS Lambda](https://transcript-yt.com/blog/youtube-transcript-api-aws-lambda), [Google Colab](https://transcript-yt.com/blog/youtube-transcript-api-google-colab).

## AI agents and MCP

The same API is an MCP server at `https://transcript-yt.com/mcp` (listed in the official MCP registry as `com.transcript-yt/transcriptyt`), so Claude Code, Cursor, Codex, VS Code and Claude Desktop can fetch transcripts as a tool. Setup: [transcript-yt.com/mcp-guide](https://transcript-yt.com/mcp-guide).

## Transcript options

| Argument | Description |
| --- | --- |
| `language` | BCP-47 code of the track to fetch |
| `translate_to` | Machine-translate to this language (150+), keeping timing |
| `format` | `json` (default), `text`, `srt`, `vtt`, `csv`, `md` |
| `include_segments` | `False` returns only the full text (JSON) |
| `timestamps` | Prefix lines with `[HH:MM:SS]` in text/md |
| `paragraphs`, `chunk_size` | Merge segments into paragraphs of up to `chunk_size` characters |
| `caption_type` | `any`, `manual`, `auto` |
| `original_language` | Prefer the spoken language over English |
| `mode` | `auto` (captions, then AI), `captions` (never AI), `ai` |
| `start_time`, `end_time` | Only part of the video, in seconds |
| `search` | Only lines containing this text |

Full API reference: [transcript-yt.com/docs](https://transcript-yt.com/docs). Using LangChain? See [`langchain-transcriptyt`](https://pypi.org/project/langchain-transcriptyt/).

## License

MIT
