DEV Community

LogicBase Systems
LogicBase Systems

Posted on Edited on

How to get transcripts from an entire YouTube playlist (no API key)

Disclosure: I made the Actor used in this article, so I'm biased. Apify links here are referral links. The same steps work with any tool that gives you captions; I note the free alternative below.

You have a YouTube playlist, say a 40-video course, and you want the text of every video. Maybe it's for a ChatGPT or Claude knowledge base, for notes, or to search across a whole series. Copy-pasting 40 transcripts by hand is a bad afternoon.

Here is how to get all of them in one go, with Python, and without a YouTube Data API key or a Google Cloud project. The result is a CSV and one Markdown file you can drop into an AI tool.

What you'll need

  • Python 3.9 or newer
  • A free Apify account (new accounts include free monthly platform credit, so the example below costs well under a cent; please check the current credit on Apify's pricing page)
  • Your Apify API token, from Settings → API & Integrations
pip install -U apify-client pandas
export APIFY_TOKEN="your-token-here"
Enter fullscreen mode Exit fullscreen mode

Step 1: Run the Actor on your playlist

YouTube Transcript & Subtitles Scraper takes playlist, channel or video links and returns one row per video. Pricing is $0.004 per transcript delivered ($4 per 1,000). Videos with no captions are not charged.

import os
import pandas as pd
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])

run = client.actor("logicbase_systems/youtube-transcript").call(run_input={
    "playlistUrls": ["https://www.youtube.com/playlist?list=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi"],
    "maxVideosPerSource": 3,   # raise this for the whole playlist
    "languages": ["en"],
    "includeSegments": False,  # plain text only, smaller output
})
Enter fullscreen mode Exit fullscreen mode

I used a short public playlist (3Blue1Brown's neural networks series) and maxVideosPerSource: 3 so you can test cheaply. Change the number, or leave it at the default of 20, once you're happy.

Step 2: Read the results

rows = list(client.dataset(run.default_dataset_id).iterate_items())
ok = [r for r in rows if r["status"] == "ok"]
print(f"{len(ok)} transcripts, {len(rows) - len(ok)} videos without a transcript")
Enter fullscreen mode Exit fullscreen mode

Every row has status. Videos that have no captions come back as status: "error" with a reason such as NO_CAPTIONS, so one bad video never breaks the whole run. Each good row has the title, channel, publish date, word count, language, and the full text.

When I ran exactly this code, I got 3 transcripts back in a few seconds.

Step 3: Save as CSV and as one file for AI tools

df = pd.DataFrame(ok)[["title", "channelName", "publishDate", "wordCount", "text", "videoUrl"]]
df.to_csv("playlist_transcripts.csv", index=False)

with open("playlist_transcripts.md", "w", encoding="utf-8") as f:
    for r in ok:
        f.write(f"# {r['title']}\n{r['videoUrl']}\n\n{r['text']}\n\n")
Enter fullscreen mode Exit fullscreen mode

You now have a spreadsheet-friendly CSV and a single Markdown file with a heading and link per video. Upload the Markdown file to ChatGPT, Claude or NotebookLM, or split it into chunks for a RAG pipeline.

Useful options

Option What it does
languages: ["en", "hi"] Preferred languages, in order. Human-made captions are used first, automatic ones as a fallback.
includeSrt: true Adds the transcript as SRT subtitle text.
includeSegments: true Adds timestamped caption lines (start, duration, text).
channelUrls Same thing for a whole channel: it takes the newest videos first.
videoUrls A plain list of video links, mixed freely with playlists and channels.

Things to know before you rely on it

  • It reads captions that already exist on the video, human-made or YouTube's automatic ones. It does not listen to audio, so videos with captions turned off can't be transcribed.
  • Automatic captions can contain mistakes, especially with names and technical terms.
  • Check that your use of the text respects YouTube's terms and the video owners' copyright.

The free DIY alternative

If you only have a few videos and don't mind some setup, you can do it yourself with yt-dlp:

yt-dlp --skip-download --write-subs --write-auto-subs --sub-langs "en.*" --convert-subs srt "PLAYLIST_URL"
Enter fullscreen mode Exit fullscreen mode

That works well from your own computer. The catch is that YouTube often blocks or rate-limits requests that come from cloud servers, so a script that runs fine locally can fail once you deploy it. Handling that (rotating IPs, retries) is the part a hosted tool takes off your hands.

Next steps

  • Run the same code on a channel: replace playlistUrls with "channelUrls": ["https://www.youtube.com/@3blue1brown"].
  • Schedule it on Apify to pull each new video's transcript automatically.
  • Send the output to Google Sheets, Notion or a vector database with Apify's n8n, Make or Zapier integrations.
  • Ready-made versions: playlist to transcripts, channel transcripts, subtitles to SRT, plain text for AI.

If something doesn't work for you, open an issue on the Actor page and I'll look at it.

Top comments (0)