Black Friday · 30% off

Get 30% off
Back to blog
Integrations

How to Get YouTube Transcripts in Python (youtube-transcript-api and a REST API)

Get a YouTube transcript in Python with the youtube-transcript-api library or a hosted REST API. Copy-paste code for both, and why the library gets blocked on cloud servers.

00:07:00 · SEP 26, 2026 · UPDATED NOV 07, 2026

Quick answer

Install youtube-transcript-api for a quick local script, or call a hosted REST API if you don't want to deal with IP blocking and PoToken issues once you deploy. Both are covered below with working code.
01

Install the open-source library

youtube-transcript-api is a well-maintained Python package that fetches YouTube's own caption data directly - no API key, no YouTube Data API quota.

pip install youtube-transcript-api

Fetch a transcript with a video ID:

from youtube_transcript_api import YouTubeTranscriptApi

api = YouTubeTranscriptApi()
transcript = api.fetch("dQw4w9WgXcQ", languages=["en"])

for snippet in transcript:
    print(snippet.text, snippet.start, snippet.duration)
02

Where this breaks once you deploy it

This works reliably on a laptop. Deployed to a cloud server, it can hit real, well-documented failures - IP blocking, PoTokenRequired, and a 'transcripts disabled' error that isn't always what it looks like. See the full diagnostic checklist for the exact causes and fixes.

03

Get an API key (if you'd rather not self-host)

Grab a free key from the dashboard - 100 free credits, no card required.

pip install requests
04

Call the hosted API from Python

No proxy pool, no IP-blocking maintenance - just an HTTP request:

import requests

response = requests.get(
    "https://getyoutubetranscript.com/api/v1/transcript",
    params={"v": "dQw4w9WgXcQ"},
    headers={"Authorization": "Bearer sk_live_..."},
)
result = response.json()

print(result["data"]["transcript"])
print(result["data"]["word_count"])

A failed request returns an error object instead of raising a library-specific exception, so the same error handling works across every endpoint.

{ "success": false, "code": "...", "message": "..." }
05

Fetching more than one video

Looping over a list of video IDs works the same way - just watch your plan's requests-per-minute limit. See the rate limit guide for backoff and retry logic.

Both approaches return the same information - the tradeoff is who maintains the infrastructure that keeps working. See full pricing (100 free credits, no card required) or read the API docs for every endpoint.

Python YouTube Transcript FAQ

Q01

Which approach should I use?

youtube-transcript-api for a quick local script or prototype. A hosted API once you're deploying to production and don't want to maintain proxy/IP-blocking workarounds yourself.

Q02

Does the hosted API require the youtube-transcript-api library?

No - it's a plain REST API. Call it with any HTTP client (requests, httpx, even curl); no Python-specific dependency required.

Q03

Can I get timestamps for each line, not just the full text?

Yes. Add timestamps=true to the transcript request and the response also includes segments: one {start, duration, text} per caption line, with times in seconds. The open-source library returns the same kind of per-snippet timing.

Q04

What happens if a video has no transcript?

Both approaches return a specific error rather than an empty string - see the diagnostic checklist for what each error code means.

Related

Listed on Tool IndexFeatured on aitoolfame.comFeatured on AI JetFeatured on AlternFeatured on the Postmake directoryFeatured on SemiLaunchFeatured on Toolso.AIAiToolGoFeatured on Aura++Featured on DeepLaunch.ioFeatured on Dofollow.ToolsFeatured on EasyDoFollowFeatured on EarlyHuntFeatured on Findly.toolsFeatured on FoundrListGood AI ToolsFeatured on IndieHuntFeatured on LaunchBuffFeatured on launched.toolsFeatured on Launch Llama ToolsFeatured on LemonLaunchLiftOff launch badgeMy Launch StashGetYouTubeTranscript on Nick LaunchesOpenHunts Club MemberFeatured on saasfame.comShinyLaunchFeatured on ShowMeBestAIFeatured on toolfame.comListed on Turbo0Featured on Twelve ToolsHuzzler Embed BadgeFeatured on CodeHypeGetYouTubeTranscript on Better LaunchDokeyAIFeatured on WayfindioFeatured on LaunchZoneFeatured on NoonlaunchFeatured on WhatsthebigdataSurfaced on CodeTrendyFeatured on ScrollLaunchFeatured on ufind.bestFeatured on ShipBoostProduct WingWe Like ToolsAppa ListAcid ToolsPower Up ToolsToshi ListAIGC 160Appsy ToolsHunt for ToolsBeam ToolsTool Find DirTool SignalSaaS Tools DirSoftware BoltProduct List DirStack DirectorySaaS FieldSaaS WheelSaaS RootsStartup BenchmarksUnite ListTrustinerBest Tool VaultSolver ToolsAsh ListSmart Kit HubAI X CollectionAI Tech ViralMillion Dot HomepageThat App ShowLaunch ScrollMy Start ToolsLatest AI UpdatesSuper AI BoomTools Under RadarThe Key ToolsTool JourneyTools List HQThe App ToolsThe Mega ToolsSource DirTool CosmosTop Trend ToolsTiny Tool HubTool PrismStartup AIdeasFeatured on WonderLaunchFeatured on ShipycornFeatured on ToolsClawListed on ProofStoriesFeatured on ToolListedLaunched on Launch StreakIndieMarkdownsFeatured on Neura MarketFeatured on BoworaFeatured on SaaSCityLaunchClashFeatured on Next LaunchFeatured on Launch VaultAI Toolz DirFeatured on SumoDirFeatured on ToolDirsShowMySitesHoToolsAiIndex.toolsGetYouTubeTranscript - Launched on QikLaunchFeatured on HiproductyFeatured on www.aitoolfinder.comSurfaced on SitePatentGetYouTubeTranscript on DebutPinFeatured on ListBulbListed on Aback LaunchFeatured on PeekLaunchGetYouTubeTranscript – Featured on PingsoldGetYouTubeTranscript: launched on Submit Your StartupListed on MydentifyFeatured on Software on the WebFeatured on So Productstarthub.zipListed on listpitch.comFeatured on 1ai.toolsGetYouTubeTranscript on ProductsFarmFeatured on NewTools.siteFeatured on The Launch FeedFeatured on IndexOf.AIListed on Ask AI For ItListed on The Launch DirectoryApp Hub ListStartup VesselSaaS AvenueToolkit IndexThe Core ToolsApp NetworkerSaaS BadgeSaaS ScannerTool IgniteTools NetworkListYourProjectFindGreatSitesWebProjectListLaunched on MarketingDBFeatured on ShowMeBestAIFeatured on SaaS CubesFeatured on NewTool.siteListed on ToolRainFeatured on AILaunchSpaceFeatured on DanielLaunchesFeatured on Web ReviewFeatured on ToolfioFeatured on IndieLaunchListed on AgentLockerFeatured on Supa LaunchFeatured on Find Top ToolsFeatured on Submit Your AI ToolFeatured on LaunchKiwiFeatured on AI Tool DiscoveryAI ToolzSniffed by PeerBearFeatured on ShipThingFeatured on Ship LaunchFeatured on FreeAIFeatured on FWFWListed on AITOOLISTListed on CollectAIFeatured on AIBoom.ToolsFeatured on Smol LaunchPadFeatured on Product-TowerFeature On aifinderplus.comFeatured on RooznaAiHeronFeatured on Spot StartupsFeatured on Brick LaunchFeatured on NoroHuntGetYouTubeTranscript on What’s New TodayFeatured on StartupOGFeatured on ToolcurioFeatured on StartupOrbitFeatured on LaunchelionFeatured on AI Alt FinderDestacado en IA SelectaDestacado en Lanzamientos IADestacado en Alternativas IAVorgestellt auf KI Tools HeuteVorgestellt auf Beste KI ToolsVorgestellt auf KI AlternativenFeatured on The AI Tools IndexFeatured on SwipeToLaunchFeatured on Sky LaunchFeatured on Wall of ToolsFeatured on Tool ListFeatured on Fast LaunchGetYouTubeTranscript - Featured on LaunchitFeatured on DailyLaunchListed on AiToolsList.ToolsAgentWiseFeatured on Tooluck.orgFeatured on IndieShowcaseAInexfinderGetYouTubeTranscript on goodSaaSFeatured on SaaSDB101 AI ToolsFeatured on ArtificinFeatured on TopAIToolsReviewAs seen on Smashing StartupsFeatured on AIExtension.aiFeatured on AIGCLISTDiscover more AI tools at aifinder.siteGenifyListed on Needle DirectoryListed on AIDirHubListed on AlterBaseFeatured on 21st ToolsFeatured on mozolistFeatured on AltHuntListed on Another DirectoryLaunched on LaunchRankedGetYouTubeTranscript on LauncHypeListed on Find Indie AppsFeatured on ToolDisk.comFeatured on AgentWork.ToolsAiTop10 ToolsFeatured on BestskyToolsFeatured on DodoDirectoryFeatured on The One StartupWhat Is Ai ToolsListed on JustSimple ToolsFeatured on LaunchatorListed on Submit AI Tools