Skip to main content

TranscriptFetch Python SDK

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

Transcripts come from YouTube, TikTok, Instagram, podcasts, or a direct media file URL (mp3/mp4/wav and friends). A podcast link (a Spotify or Apple Podcasts episode URL, or an RSS feed URL) is resolved to that episode's audio automatically. Channel, playlist and search are YouTube-only, since no other supported platform has those concepts.

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 / podcast / 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)

Get an API key (100 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)                    # up to 50 transcripts in one call
tf.transcripts.channel(channel, limit=, cursor=)   # a YouTube channel's videos (metadata)
tf.transcripts.playlist(playlist, limit=, cursor=) # a YouTube playlist's videos
tf.transcripts.search(query, limit=, cursor=)      # search YouTube
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 podcast link (Spotify or Apple Podcasts episode, or an RSS feed), a direct media file URL, or a bare YouTube ID. channel/playlist take a URL, an @handle/PL… ID, or a raw ID. IDs and URLs are normalized automatically.

Sources without captions (including every podcast)

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. Podcast audio never has captions, so a podcast always takes this path:

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)

A transcript resolved from a podcast link also carries a podcast block, so the show and episode survive the round trip (otherwise the result would be titled after the mp3 filename):

t = tf.transcripts.video("https://podcasts.apple.com/us/podcast/…")
print(t.platform)          # "podcast"
print(t.podcast.show, "-", t.podcast.episode)

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, .message, and .request_id:

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transcriptfetch_sdk-1.0.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

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

transcriptfetch_sdk-1.0.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file transcriptfetch_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: transcriptfetch_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for transcriptfetch_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0f673570d3009ebd965c09744ca705adc5971b7861d36fc543186099ab73e7e2
MD5 1b696396012d1ce9c6b592fe5629e1bc
BLAKE2b-256 fae8a65e11414e1863c7c3da76e6155cfe3408298291d3b25d7337a5b8dd139b

See more details on using hashes here.

Provenance

The following attestation bundles were made for transcriptfetch_sdk-1.0.0.tar.gz:

Publisher: release.yml on TranscriptFetch/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file transcriptfetch_sdk-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for transcriptfetch_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c18e52bfa54d89091c18e7cda685231f1612888659d25be3ecc12ebc4a1dad8
MD5 ca7d9d6216086068d7b2918b5e3ae6fb
BLAKE2b-256 a4cf752de8498782f18d3eb02211f20323f8f28c9706d2e2cc913b357bda356a

See more details on using hashes here.

Provenance

The following attestation bundles were made for transcriptfetch_sdk-1.0.0-py3-none-any.whl:

Publisher: release.yml on TranscriptFetch/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.0.0

2 files

1.0.2

2 files

1.0.1

2 files

This release

1.0.0 This release

2 files

0.1.0

2 files

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