Telegram YouTube player

A neat way to use my TV with my home server over HDMI, so I never have to touch the TV’s own OS.

My TV is connected to my home server over HDMI, and I wanted to use it without ever touching the TV’s own system. So I built a Telegram bot for it. I send it a YouTube link in Telegram, and the video opens fullscreen on the monitor I picked.

You can send several links at once, and they go into a queue that survives restarts. The video plays in a browser with its own separate profile, so my normal browser stays untouched, and content blocking is switched on. When a video ends, the next one starts, and a few commands (/queue, /skip, /skipall, /clear, /status and /stop) control everything. Only my own Telegram account is allowed to send them.

You don’t even need a link. If you describe what you want, a small AI agent takes over: it searches the web through Ollama’s web search, and a small AI model running on the same computer (Qwen3, 0.6 billion parameters) picks the best of the top three results. It can only choose from what the search found, and the app checks that the link it returns is exactly one of them, so it can’t make one up. If the pick is a YouTube video, it joins the queue, and if it’s another page, the bot opens that instead. Links to local or private addresses are refused. The agent comes bundled with the app (the setup downloads the model through Ollama), and you can swap in your own script. The search itself runs online, so only the choosing happens on my computer.

Getting it to work the same on Linux, Windows and macOS was the tricky part. Putting a browser fullscreen on the right monitor works differently on each system, and on a Mac, Firefox needs Accessibility permission to do it. The app also has to know when a video has ended, so it plays inside a small local page that uses YouTube’s player and tells the app. And after a crash or a restart it has to work out whether the browser it remembers is still its own. The automatic tests run on all three systems, but playing on a real second monitor can only be tested on the actual machine.