Skip to main content

fetchworks

YouTube transcripts for Python — timestamped segments, plain text, SRT, and VTT from videos, Shorts, channels, playlists, and search results.

This is a thin, pure-stdlib client (no dependencies, Python 3.9+) for the Fetchworks YouTube Transcript Scraper on Apify. The extraction runs on Apify's infrastructure; you bring your own Apify token. Pricing is $2 per 1,000 transcripts — only delivered transcripts are billed. Failed videos (no captions, blocked, unavailable) cost nothing.

Install

pip install fetchworks

Quickstart

import os
from fetchworks import FetchworksClient

client = FetchworksClient(os.environ["APIFY_TOKEN"])
item = client.get_transcript("https://www.youtube.com/watch?v=jNQXAC9IVRw")
print(item["status"])  # "ok"
print(item["text"])    # "All right, so here we are…"

Get a token by signing up at apify.com (free tier included), then copy it from console.apify.com/settings/integrations.

API

All methods return dataset items in the exact shape the actor emits — including an honest per-video status (ok, no_captions, blocked, live_stream, age_restricted, unavailable, translation_unavailable, po_token_required, error). A video without captions comes back as an item with status: "no_captions", never a silent empty transcript.

# One video (URL, Shorts/youtu.be/embed URL, or bare 11-char ID)
item = client.get_transcript("jNQXAC9IVRw", languages=["en", "de"])

# A batch of videos
items = client.get_transcripts(["url1", "url2"], output_formats=["text", "srt"])

# A channel's uploads, newest first
uploads = client.get_channel_transcripts("@3blue1brown", max_videos_per_channel=25)

# A playlist
playlist = client.get_playlist_transcripts("PLZHQObOWTQDMsr9K-rj53DwVRMYO3t5Yr")

# Top results for a YouTube search
results = client.search("neural networks explained", max_search_results=10)

Jobs expected to cover fewer than 60 videos run on Apify's synchronous endpoint and return in seconds. Larger jobs (big batches, whole channels, playlists) start an actor run and poll until it finishes — no code change needed on your side.

Options

Every method accepts keyword options mirroring the actor input:

Option Type Default Description
languages list[str] ["en"] Language priority list (ISO codes). First available caption track wins; the item reports the actual language used.
prefer_auto_generated bool False Prefer auto-generated (ASR) tracks when a manual track also exists.
translate_to str Target language for YouTube caption auto-translation. Best-effort; failures come back as translation_unavailable and are not billed.
output_formats list[str] ["segments", "text"] Any of "segments", "text", "srt", "vtt".
include_metadata bool True Include title, channel, duration, views, publish date, etc. Free.
include_chapters bool False Include video chapters (one extra request per video).
max_videos_per_channel int 100 Channel method only: upper bound on videos taken, newest first.
max_search_results int 50 Search method only: upper bound on videos taken per query.

Client-level options: base_url, poll_interval (default 3.0 s), max_wait (default 30 min).

Result shape

{
    "videoId": "jNQXAC9IVRw",
    "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "status": "ok",
    "language": "en",
    "isAutoGenerated": False,
    "availableLanguages": [{"languageCode": "en", "kind": "manual", "name": "English"}],
    "segments": [{"start": 1.3, "dur": 3.4, "text": "All right, so here we are"}],
    "text": "All right, so here we are…",
    "srt": "…",   # when requested
    "vtt": "…",   # when requested
    "metadata": {"title": "Me at the zoo", "author": "jawed", "lengthSeconds": 19},
}

Links

License

MIT

Download files

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

Source Distribution

fetchworks-0.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

fetchworks-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file fetchworks-0.1.0.tar.gz.

File metadata

  • Download URL: fetchworks-0.1.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for fetchworks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ebbb272d047cd0a377c9860caacde33bb4e9f0397d1edf700d08573ae6cf1938
MD5 7c808c15b8d19d37e10ef049cfc61a45
BLAKE2b-256 cb9a70ac7186f8fa5732d84d07f801f30cd11628cf5919aee611c6c6f86e69b9

See more details on using hashes here.

File details

Details for the file fetchworks-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fetchworks-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for fetchworks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4c8f45a1c03b452f2fdd8d495945914ff2d8ab38f97a63823a5c6497db56498
MD5 9610667ae713f5e2310022d528342220
BLAKE2b-256 b631444349e97b76ae0ce1ff6a5b4412c608583bc570ab6a728ad1d61f2e6025

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

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