Patching yt-dlp over and over
I use yt-dlp whenever I want to be able to watch something offline.
I am already paying for YouTube Premium, which includes an offline function, but that is something I would mostly use on my phone (e.g. for video podcasts who jokingly refer to me as an “audio listener”). When I want to bring something over to the living room TV, or watch on my laptop when travelling, nothing beats MP4 files on disk.
When I download media, I sometimes need to use my actual credentials. Because it is a members only video on YouTube, or behind authentication on some other platform.
Now the problem is, I also use Firefox with a bunch of isolating features such as Firefox containers.
Just over a year ago I opened a PR on yt-dlp to fix accessing Firefox cookies in containers. It has not yet been merged.
I use Homebrew to install and update yt-dlp. This means my local patch keeps disappearing and I have to apply it over and over. Not actually a problem except for the fact that I keep forgetting where yt-dlp is.
So once and for all for future me, this is the file you need to patch:
readlink -f (fd --no-ignore "cookies.py" (brew --prefix yt-dlp) | grep yt_dlp)
(Running this today on macOS it results in the file path: /opt/homebrew/Cellar/yt-dlp/2025.4.30/libexec/lib/python3.13/site-packages/yt_dlp/cookies.py
.)