YouTube ads are served by the browser's web player. So if you skip the browser entirely and stream directly using CLI tools, the ad delivery system is never involved not blocked, just never requested.
The setup is simple: yt-dlp resolves a search query into a direct stream URL, and mpv plays it. No browser opens, no web player loads, no ads.
I wrapped this into a small desktop GUI called. You type a search, hit play, and mpv starts streaming. Supports audio-only or video mode, pause/stop, and uses mpv's IPC socket so controls actually work properly.
The whole thing is about 200 lines of Python and Tkinter.
How it works
Search query β yt-dlp β direct stream URL β mpv
yt-dlp handles the ytsearch1: prefix, so you never need to copy a URL. Just type what you want to hear or watch.
For video mode, yt-dlp fetches separate video and audio stream URLs and passes both to mpv via --audio-file, which is how YouTube serves high-quality streams anyway.
mpv gets an IPC socket at /tmp/mpvsocket so pause, stop, and future controls can send commands directly without needing to track the subprocess.
Have a look
github.com/satkarjuneja/Playbin
Only hard dependency is mpv. yt-dlp is bundled.
Please give feedback of any better solutions of this sort
Thanks.

Top comments (0)