<?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: Yusuf Yildiz</title>
    <description>The latest articles on DEV Community by Yusuf Yildiz (@yyildiz).</description>
    <link>https://dev.to/yyildiz</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%2F931242%2Fd0cb6e07-c69b-4912-b05a-98b7e5a71e9e.jpeg</url>
      <title>DEV Community: Yusuf Yildiz</title>
      <link>https://dev.to/yyildiz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yyildiz"/>
    <language>en</language>
    <item>
      <title>Recording a YouTube live stream with yt-dlp (the flags that actually matter)</title>
      <dc:creator>Yusuf Yildiz</dc:creator>
      <pubDate>Tue, 17 Nov 2026 08:16:03 +0000</pubDate>
      <link>https://dev.to/yyildiz/recording-a-youtube-live-stream-with-yt-dlp-the-flags-that-actually-matter-cca</link>
      <guid>https://dev.to/yyildiz/recording-a-youtube-live-stream-with-yt-dlp-the-flags-that-actually-matter-cca</guid>
      <description>&lt;p&gt;If you've tried to grab a YouTube live stream with yt-dlp and ended up with half a broadcast or just an error, the thing to know is that a live stream isn't a finished file - it's an ongoing feed, and a couple of flags decide what you actually get.&lt;/p&gt;

&lt;p&gt;Here's what I've landed on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Just record from now
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yt-dlp &lt;span class="s2"&gt;"https://www.youtube.com/watch?v=VIDEO_ID"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Point it at a stream that's live and it records from the current moment until the broadcast ends (or you ctrl-c). No special flag needed for a basic capture - the live URL is the same &lt;code&gt;/watch?v=&lt;/code&gt; one as any other video.&lt;/p&gt;

&lt;h2&gt;
  
  
  Catch it from the start
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yt-dlp --live-from-start &lt;span class="s2"&gt;"https://www.youtube.com/watch?v=VIDEO_ID"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By default yt-dlp joins where the stream currently is, so anything broadcast before you ran the command is gone. &lt;code&gt;--live-from-start&lt;/code&gt; rewinds to the beginning. It can pull a lot of data for a long stream and it's slower because it has to walk every fragment, but it's the only way to get the opening.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wait for a stream that hasn't started yet
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yt-dlp --wait-for-video 30-600 --live-from-start &lt;span class="s2"&gt;"URL"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A plain command just errors out if the stream isn't live yet. &lt;code&gt;--wait-for-video MIN-MAX&lt;/code&gt; keeps re-checking (those are the min/max seconds between checks) and starts the moment it goes live. Handy to leave running ahead of a scheduled premiere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep a playable file if the capture drops
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yt-dlp --live-from-start --hls-use-mpegts -N 4 &lt;span class="s2"&gt;"URL"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A capture can run for hours, so assume it'll get interrupted. &lt;code&gt;--hls-use-mpegts&lt;/code&gt; writes to an MPEG-TS container that stays playable even if the process dies mid-stream, so you keep what you recorded instead of a corrupt file. &lt;code&gt;-N 4&lt;/code&gt; grabs a few fragments at once to keep up with a high-bitrate stream. When it ends cleanly you can &lt;code&gt;--remux-video mp4&lt;/code&gt; if you need something more portable.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest caveats
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A live stream can't be retried.&lt;/strong&gt; For a normal video a failed fragment is just re-requested. In a live capture there's no going back in time, so if the connection drops for a stretch, that part of the broadcast is simply gone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Some live formats need a PO token now.&lt;/strong&gt; Missing it shows up as missing formats or a capture that stops after a short while.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep yt-dlp updated.&lt;/strong&gt; Player changes break live extraction faster than they break normal downloads - run &lt;code&gt;yt-dlp -U&lt;/code&gt; before a scheduled capture, not during one.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why it's worse on a server
&lt;/h2&gt;

&lt;p&gt;If you're running this from a VPS or a CI runner, you've got two problems stacked. YouTube throttles and blocks datacenter IPs harder than home connections, so a server capture is more likely to hit a mid-stream block. And because a live stream can't be replayed, that block turns into a permanent gap instead of a retry. The free fix is to run captures from a clean residential IP, keep yt-dlp current, and use &lt;code&gt;--live-from-start --hls-use-mpegts&lt;/code&gt; so an interruption still leaves a usable partial file.&lt;/p&gt;

&lt;p&gt;fwiw I run a hosted API for exactly this "works on my laptop, dies on the server" problem (I built &lt;a href="https://www.importly.io" rel="noopener noreferrer"&gt;importly.io&lt;/a&gt; - you POST a URL and get the file or transcript back from infra that isn't blocked), so if you're capturing from a server and don't want to babysit IPs it might save you some time. For a one-off from your own machine though, the flags above are all you need.&lt;/p&gt;

&lt;p&gt;Full writeup with the related guides: &lt;a href="https://ytdlp.org/guides/yt-dlp-download-youtube-live" rel="noopener noreferrer"&gt;https://ytdlp.org/guides/yt-dlp-download-youtube-live&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>webscraping</category>
      <category>tutorial</category>
      <category>devops</category>
    </item>
    <item>
      <title>yt-dlp works on my laptop but not on my server - here's what's actually going on</title>
      <dc:creator>Yusuf Yildiz</dc:creator>
      <pubDate>Tue, 17 Nov 2026 02:56:35 +0000</pubDate>
      <link>https://dev.to/yyildiz/yt-dlp-works-on-my-laptop-but-not-on-my-server-heres-whats-actually-going-on-2a75</link>
      <guid>https://dev.to/yyildiz/yt-dlp-works-on-my-laptop-but-not-on-my-server-heres-whats-actually-going-on-2a75</guid>
      <description>&lt;p&gt;I kept hitting this and it drove me a little crazy, so here's the short version in case it saves someone an afternoon.&lt;/p&gt;

&lt;p&gt;Same command. Same yt-dlp version. Same URL. On my laptop it downloads fine. On my EC2 box it throws &lt;code&gt;ERROR: ... Sign in to confirm you're not a bot&lt;/code&gt;, or a 403, or just "no formats found". Nothing in the command changed, so for a while I assumed the server was missing something - a dependency, a JS runtime, cookies, whatever.&lt;/p&gt;

&lt;p&gt;It wasn't any of that. It's the IP.&lt;/p&gt;

&lt;h2&gt;
  
  
  The actual diagnosis
&lt;/h2&gt;

&lt;p&gt;YouTube scores the IP the request comes from. Residential and mobile IPs (your home, your phone) are trusted. Datacenter IPs - AWS, GCP, most VPS providers, Hetzner, DigitalOcean - are not, and a lot of those ranges are already burned because everyone and their scraper runs from them. So the same request that sails through from your couch gets a bot check from your server.&lt;/p&gt;

&lt;p&gt;Quick way to confirm it's the IP and not your setup: run the exact same thing on both machines.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yt-dlp --version          &lt;span class="c"&gt;# make sure these match&lt;/span&gt;
yt-dlp --simulate -F &lt;span class="s2"&gt;"https://www.youtube.com/watch?v=jNQXAC9IVRw"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your laptop lists formats and the server throws a bot check with the &lt;em&gt;same version&lt;/em&gt;, you're not debugging yt-dlp anymore. You're debugging IP reputation. Updating yt-dlp again won't change that (worth doing once to rule out a stale build, but that's it).&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually helps (honest order)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Run it from a residential connection.&lt;/strong&gt; If you can run the download on your own machine, a home server, or anything on a residential/mobile IP, do that. It's free and it just works. For a lot of hobby setups this is the whole answer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route through a residential proxy.&lt;/strong&gt; &lt;code&gt;--proxy "http://user:pass@host:port"&lt;/code&gt; through a &lt;em&gt;residential&lt;/em&gt; proxy makes the request look like a person again. This works, but residential proxies cost real money per GB, and a datacenter proxy won't help - it's the same category of IP as your server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pass cookies from a logged-in account.&lt;/strong&gt; &lt;code&gt;--cookies cookies.txt&lt;/code&gt; sometimes gets you through, but it ties the download to a real account (which YouTube can rate-limit or flag), and on a bad IP it often still fails. Treat it as a maybe, not a fix.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What doesn't help: a datacenter VPN (same burned IP category), and updating for the fifth time.&lt;/p&gt;

&lt;p&gt;I wrote up the longer version with the full diagnosis and the stuff that does and doesn't work here: &lt;a href="https://ytdlp.org/guides/yt-dlp-blocked-on-server" rel="noopener noreferrer"&gt;https://ytdlp.org/guides/yt-dlp-blocked-on-server&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  If you just don't want to deal with the IP problem
&lt;/h2&gt;

&lt;p&gt;Honestly, for a weekend project, run it locally and move on. The IP thing only really becomes a tax when you're running this server-side or inside some agent sandbox you don't control and can't put on a residential IP.&lt;/p&gt;

&lt;p&gt;That second case is the one I got stuck on, so I ended up building &lt;a href="https://importly.io" rel="noopener noreferrer"&gt;importly.io&lt;/a&gt; for it - a hosted API (and MCP server) that takes a video or audio URL and gives you back the download, transcript, or metadata, running on residential proxies on its end so the IP reputation isn't your problem. Full disclosure, it's my thing. There's a free tier if you want to see whether it gets past what your server can't. If you're happy self-hosting on a residential box, you genuinely don't need it.&lt;/p&gt;

&lt;p&gt;Anyway - if yt-dlp "suddenly broke in production" and works everywhere else, check the IP before you rewrite anything.&lt;/p&gt;

</description>
      <category>python</category>
      <category>devops</category>
      <category>webdev</category>
      <category>youtube</category>
    </item>
  </channel>
</rss>
