yt-dlp on Linux VPS works with fresh YouTube cookies, but cookies rotate quickly and video downloads start failing. Any stable solution?

Posted by vazhadval@reddit | programming | View on Reddit | 6 comments

I’m running a small app on a Linux VPS that uses yt-dlp to:

  1. fetch YouTube transcripts
  2. download source video
  3. cut shorts with ffmpeg

I got most of it working, but I have a recurring problem with YouTube cookies.

Current setup:

What I observed:

A manual command like this can work right after I upload fresh cookies:

/usr/local/bin/yt-dlp -v \
  --cookies "/root/youtube-cookies.txt" \
  --js-runtimes "node" \
  --remote-components "ejs:github" \
  --list-formats \
  "https://www.youtube.com/watch?v=VIDEO_ID"

But after some time, the same cookies stop working and I need to export/upload them again.

I also tried:

Question: