Essentially you self-host it and it operates, I assume, via YouTube’s API or scraping.
Invidious is another alternative frontend to youtube. I use it because it loads much faster than YT and it has an API that makes it easy for me to batch download my playlists. However it occasionally gets authentication errors and I have to restart the service manually.