Skip to main content

TranscriptFetch

TranscriptFetch Python SDK

Official, typed Python client for the TranscriptFetch API: fetch transcripts as clean, structured data, plus channel, playlist and search listings across YouTube, TikTok and Instagram. Sync + async, fully type-hinted.

Transcripts come from YouTube, TikTok, Instagram, or a direct media file URL (mp3/mp4/wav and friends). Channel and playlist take a URL from any of those platforms and detect it; search is YouTube by default, or any of them via platform=.

pip install transcriptfetch-sdk

Quickstart

from transcriptfetch import TranscriptFetch

# api_key falls back to the TRANSCRIPTFETCH_API_KEY env var
tf = TranscriptFetch(api_key="tf_live_...")

t = tf.transcripts.video("https://youtu.be/aircAruvnKk")   # or a TikTok / Instagram / file URL
print(t.title)
print(t.text)
for seg in t.segments:
    print(f"[{seg.start:.1f}] {seg.text}")

print("credits left:", t.usage.balance)

Every transcript carries the same metadata whichever platform served it: video_id, url, platform, title, channel (the creator), duration in seconds, language, thumbnail_url and source ("captions" or "audio"). A value the API could not determine is None, never missing.

Get an API key (50 free credits) at https://transcriptfetch.com/app. One credit per successful fetch; failed/blocked/no-transcript requests are free.

Endpoints

tf.transcripts.video(video)                        # single transcript (text + segments)
tf.transcripts.batch(video_ids, mode=)             # up to 50 transcripts in one call
tf.transcripts.channel(channel, limit=, cursor=)   # a channel's or creator's videos (metadata)
tf.transcripts.playlist(playlist, limit=, cursor=) # a playlist's videos
tf.transcripts.search(query, platform=, limit=, cursor=)  # keyword search, YouTube by default
tf.transcripts.job(job_id)                         # poll an audio-transcription job (free)
tf.me()                                            # validate the key + read the balance (free)
tf.health()                                        # unauthenticated liveness probe

video and batch take a YouTube, TikTok or Instagram URL, a direct media file URL, or a bare YouTube ID. channel/playlist take a YouTube, TikTok or Instagram URL (or a YouTube @handle / PL… id) and detect the platform from it. search searches YouTube unless you pass platform:

page = tf.transcripts.search("lofi hip hop", platform="tiktok", limit=10)
for v in page.videos:
    print(v.title, v.published_at, v.stats.plays if v.stats else None)
    t = tf.transcripts.video(v.url)

Sources without captions

When a source has no captions, the API transcribes its audio and answers with a job instead of a transcript. That comes back as a Transcript with status == "processing" and a job_id; poll it for free until it completes.

import time

t = tf.transcripts.video("https://www.tiktok.com/@user/video/7137723462233555205")
while t.status == "processing":
    time.sleep(3)
    t = tf.transcripts.job(t.job_id)
print(t.text)

Batch works the same way by default (mode="auto"): entries with no caption track are transcribed from audio, come back with outcome == "processing" and a job_id, cost nothing on that call, and are charged on delivery at the audio rate. Re-send the same batch once the jobs have had time to finish and the text comes back normally — or poll each job_id with tf.transcripts.job(). Pass mode="captions" to read existing caption tracks only, in which case a captionless video fails as outcome == "error" with error.code == "no_captions" (and error.retry_with naming the audio mode):

res = tf.transcripts.batch(ids)                    # captionless entries -> "processing" + job_id
pending = [r.job_id for r in res.results if r.outcome == "processing"]

res = tf.transcripts.batch(ids, mode="captions")   # captions only, no audio fallback

Chunks and Markdown for RAG (2.5.0+)

t = tf.transcripts.video("https://www.youtube.com/watch?v=aircAruvnKk", chunks=True, markdown=True)

for c in t.chunks:                # embedding-sized pieces, split between caption lines
    print(c.index, c.start, c.end, c.tokens, c.url)   # url opens the video at c.start
print(t.markdown)                 # title, channel, length, then timestamped paragraphs

chunks=True uses 500-token pieces with a 50-token overlap; pass {"max_tokens": 800, "overlap_tokens": 80} to change them (100 to 2000, overlap 0 to 200). Both options are free, work on batch() too, and an audio-transcription job delivers them when it finishes. For LangChain and LlamaIndex, use langchain-transcriptfetch and llama-index-readers-transcriptfetch, which are built on these.

Monitors (2.4.0+)

Watch a YouTube channel or a TikTok/Instagram profile for new videos. Creation reads the target once to record what is already there (existing videos are skipped) and starts scheduled checks. Every check costs 1 credit whether or not it finds new videos, and so does that first read; caption transcripts cost 1 credit more each when enabled. A check whose listing fails is free. See monitor docs for plan limits, audio billing, retention and webhook verification.

with TranscriptFetch(timeout=120) as tf:
    monitor = tf.monitors.create("@lexfridman", interval_minutes=60, transcripts=True)
    # Save monitor.webhook_secret securely: it is only returned on creation.
    # Optional webhook_url="https://your-app.com/hooks/transcriptfetch".
    # YouTube only: tab="shorts" (or "videos" / "live").
    all_monitors = tf.monitors.list()
    news = tf.monitors.list(since=all_monitors.last_event_id)
    current = tf.monitors.get(monitor.id)
    page = tf.monitors.events(monitor.id, limit=10)
    for event in tf.monitors.iter_events(monitor.id, since=current.last_event_id):
        print(event.type, event.data)
    tf.monitors.update(monitor.id, status="paused")
    tf.monitors.update(monitor.id, webhook_url=None, name=None, transcripts=False)
    # Omitted settings stay unchanged. None clears webhook_url/name.
    tf.monitors.update(monitor.id, status="active")
    checked = tf.monitors.check(monitor.id)  # 1 credit, found or not
    if checked.error:  # listing failure, even with HTTP 200
        print(checked.error)
    tf.monitors.delete(monitor.id)  # removes events too

AsyncTranscriptFetch exposes the same methods with await; use async for with tf.monitors.iter_events(...). Models use snake_case. monitor.videos events carry data.videos and optional data.transcripts with ok, processing or error outcomes. monitor.transcript events carry the follow-up result in data, linked to the parent via videos_event_id. delivery describes webhook attempts. Reading never marks events read: persist the latest event id and pass it as since. Iteration preserves since across cursor pages. Create/check accept idempotency_key; the generated key stays stable on retries. Use a longer client timeout for creation/manual checks, which read the platform.

Single-video options are also supported:

transcript = tf.transcripts.video("dQw4w9WgXcQ", mode="captions", timestamps=False)

Pagination

List endpoints are cursor-paginated. Iterate every result without managing cursors:

for video in tf.transcripts.iter_channel("@lexfridman", limit=10):
    print(video.video_id, video.title)

Or page manually via page.next_cursor and the cursor= argument.

Async

import asyncio
from transcriptfetch import AsyncTranscriptFetch

async def main():
    async with AsyncTranscriptFetch() as tf:
        t = await tf.transcripts.video("aircAruvnKk")
        print(t.text)
        async for v in tf.transcripts.iter_search("how transformers work", limit=10):
            print(v.title)

asyncio.run(main())

Errors

All errors subclass TranscriptFetchError. API errors carry .status, .code, .number (the thousands digit is the family; 5xxx means retry), .message, .docs, .retry_with (the request change that would succeed, when there is one), .details, .request_id, and a .retryable property:

from transcriptfetch import (
    AuthenticationError, InsufficientCreditsError, InvalidRequestError,
    RateLimitError, IdempotencyConflictError, UpstreamUnavailableError,
    InternalServerError, APIError, APIConnectionError, APITimeoutError,
)

try:
    tf.transcripts.video("bad")
except InsufficientCreditsError:
    ...                       # 402: top up at /pricing
except RateLimitError as e:
    print(e.retry_after)      # 429
except APIError as e:
    print(e.status, e.code, e.request_id)

Reliability

  • Automatic retries on 429 (honoring Retry-After) and 5xx, with exponential backoff + jitter (max_retries=2 by default).
  • Idempotency: every write auto-sends an Idempotency-Key so a retried request is never double-charged. Override per call with idempotency_key=....
  • Configurable: TranscriptFetch(api_key=..., base_url=..., timeout=30, max_retries=2). Both clients are context managers and accept a custom http_client= (httpx).

Development

pip install -e ".[dev]"
ruff check . && mypy src && pytest

Tests are fully mocked (no network). MIT licensed.

Metadata

Release files for transcriptfetch-sdk 2.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for transcriptfetch-sdk 2.5.0
File Size Uploaded Provenance Actions
transcriptfetch_sdk-2.5.0.tar.gz 37.1 kB With provenance Details for transcriptfetch_sdk-2.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for transcriptfetch-sdk 2.5.0
File Interpreter ABI Platform Actions
transcriptfetch_sdk-2.5.0-py3-none-any.whl Python 3 none any Details for transcriptfetch_sdk-2.5.0-py3-none-any.whl

Total release size: 62.2 kB

Release files / transcriptfetch_sdk-2.5.0.tar.gz

Download URL transcriptfetch_sdk-2.5.0.tar.gz
Size 37.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ee1bad5d9be8add3edc3bb0888cf1dc7e72355c288cac5b4e0c62f871f22c0b5
BLAKE2b-256 checksum
How to use checksums
4cc78cff3121a55562893bdc9396745f071aa57f4c19c39abf2cbbc8b3104d52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / transcriptfetch_sdk-2.5.0-py3-none-any.whl

Download URL transcriptfetch_sdk-2.5.0-py3-none-any.whl
Size 25.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cc5d56ed107644c470c940651636ad5a8cfc7c9ae3a0c3d4f8aea683eeaa840
BLAKE2b-256 checksum
How to use checksums
434a0ce065cbc1997f4d4513a5b20aebda143307fb63cb88f9f586d0964c9c5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Security for transcriptfetch-sdk 2.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for transcriptfetch_sdk-2.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page