<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Damir Bolat</title>
    <description>The latest articles on DEV Community by Damir Bolat (@dbolat88).</description>
    <link>https://dev.to/dbolat88</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4214890%2F85da6e46-f896-4719-8ee0-172772aa59d6.png</url>
      <title>DEV Community: Damir Bolat</title>
      <link>https://dev.to/dbolat88</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dbolat88"/>
    <language>en</language>
    <item>
      <title>Why youtube-transcript-api works on your laptop but fails on the server (and 3 ways to fix it)</title>
      <dc:creator>Damir Bolat</dc:creator>
      <pubDate>Thu, 29 Oct 2026 09:38:40 +0000</pubDate>
      <link>https://dev.to/dbolat88/why-youtube-transcript-api-works-on-your-laptop-but-fails-on-the-server-and-3-ways-to-fix-it-1254</link>
      <guid>https://dev.to/dbolat88/why-youtube-transcript-api-works-on-your-laptop-but-fails-on-the-server-and-3-ways-to-fix-it-1254</guid>
      <description>&lt;p&gt;You wrote a few lines with &lt;code&gt;youtube-transcript-api&lt;/code&gt;, it worked on your laptop, you deployed it to AWS, Google Cloud, Azure or a cheap VPS - and every call now fails with &lt;code&gt;RequestBlocked&lt;/code&gt; or &lt;code&gt;IpBlocked&lt;/code&gt;. Older versions of the library reported the same thing as &lt;code&gt;TranscriptsDisabled&lt;/code&gt;, which sent many people hunting for a bug that wasn't there.&lt;/p&gt;

&lt;p&gt;Your code is fine. The problem is where the request comes from.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it happens
&lt;/h2&gt;

&lt;p&gt;YouTube refuses most requests that come from IP addresses known to belong to cloud providers. The library's own README says so: "YouTube has started blocking most IPs that are known to belong to cloud providers (like AWS, Google Cloud Platform, Azure, etc.)". A home connection looks like a viewer; a data center looks like a bot.&lt;/p&gt;

&lt;p&gt;I measured it while building a transcript tool in October 2026:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;requests sent straight from a data center: &lt;strong&gt;every one refused&lt;/strong&gt;;&lt;/li&gt;
&lt;li&gt;through data-center proxies: &lt;strong&gt;58% refused&lt;/strong&gt;;&lt;/li&gt;
&lt;li&gt;through rotating residential addresses with a retry from a new address: &lt;strong&gt;599 of 600 answered&lt;/strong&gt; in two runs of 300 recent videos each.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the fix is always the same idea: the request has to leave from an address YouTube treats as a regular viewer. There are three ways to get there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 1: run it from a residential connection
&lt;/h2&gt;

&lt;p&gt;If you need a handful of transcripts, run the script on your own machine or a home server. No extra cost, no setup.&lt;/p&gt;

&lt;p&gt;Watch out for VPNs: a VPN exit node can be a data-center address too, and then YouTube blocks it the same way.&lt;/p&gt;

&lt;p&gt;This does not scale and does not work for anything that has to run in the cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 2: residential proxies with the library
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;youtube-transcript-api&lt;/code&gt; supports proxies out of the box. With any provider of rotating residential proxies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;youtube_transcript_api&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;YouTubeTranscriptApi&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;youtube_transcript_api.proxies&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;GenericProxyConfig&lt;/span&gt;

&lt;span class="n"&gt;ytt_api&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;YouTubeTranscriptApi&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;proxy_config&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;GenericProxyConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;http_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http://user:pass@my-custom-proxy.org:port&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;https_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://user:pass@my-custom-proxy.org:port&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;transcript&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ytt_api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;jNQXAC9IVRw&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The README also has a ready config for Webshare (&lt;code&gt;WebshareProxyConfig&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Two things to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;buy &lt;strong&gt;rotating residential&lt;/strong&gt; proxies. Static and data-center proxies get blocked, just later;&lt;/li&gt;
&lt;li&gt;even residential addresses are refused now and then, so add a retry that switches to a new address.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the right choice if you already pay for proxies or fetch transcripts at a very large scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 3: a hosted transcript API
&lt;/h2&gt;

&lt;p&gt;If you would rather not manage proxies and retries, use a hosted service: you send video links, it returns transcripts. There are several.&lt;/p&gt;

&lt;p&gt;Disclosure: I built one of them, on Apify - &lt;a href="https://apify.com/dbolat88/youtube-transcript-pay-per-success" rel="noopener noreferrer"&gt;YouTube Transcript Scraper - Pay Only for Success&lt;/a&gt;. It does exactly the residential-address-plus-retry routine described above. What makes it different:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;you pay only for transcripts actually delivered&lt;/strong&gt;: $0.004 each, $4 per 1,000. A video without captions, a deleted video or a broken link comes back as a row with the reason and costs nothing;&lt;/li&gt;
&lt;li&gt;on paid Apify plans it is cheaper: $3.50 per 1,000 on Starter, $3.00 on Scale, $2.50 on Business;&lt;/li&gt;
&lt;li&gt;plain text, timed segments or SRT;&lt;/li&gt;
&lt;li&gt;the original language of the video by default, or the languages you name;&lt;/li&gt;
&lt;li&gt;Apify's free plan gives a $5 monthly credit, which covers about 1,250 transcripts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One request runs it and returns the rows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="s2"&gt;"https://api.apify.com/v2/acts/dbolat88~youtube-transcript-pay-per-success/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"videoUrls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"], "outputFormat": "text"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It does not transcribe audio: a video with no captions at all has nothing to return.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which one to pick
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Your situation&lt;/th&gt;
&lt;th&gt;Pick&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A few videos, now and then&lt;/td&gt;
&lt;td&gt;Option 1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;You already pay for residential proxies, or need huge volume&lt;/td&gt;
&lt;td&gt;Option 2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Code runs in the cloud and you don't want to maintain proxies&lt;/td&gt;
&lt;td&gt;Option 3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Whichever you choose, the key point stays the same: the request must not come from a data-center address.&lt;/p&gt;

</description>
      <category>webscraping</category>
      <category>cloud</category>
      <category>python</category>
      <category>api</category>
    </item>
  </channel>
</rss>
