I guess that's when you double down and just scrape Invidious[1] for the audio files.
edit: The Firefox extension "Privacy Redirect"[2] also uses Invidious to automatically redirect all youtube links, and does similar things for pages like reddit and twitter to their respective "mirrors".
For anyone else wondering "what the heck is invidious?", from their github[1]: "Invidious is an alternative front-end to YouTube." Cool!
But man, classic open source: the front page of those docs says nothing about what the heck the project is, just a list of URLs to visit, and the main website[2] is just an under-construction page with a link to the github repo.
Wow, I had no idea about Invidious. This perfectly solves my use case of needing a REST API to get MP3 urls for YouTube videos. I was looking into building or finding a REST API for youtube-dl, but this seems a lot easier.
The mirrors frequently go offline from being blocked though, so it may be easier to rely on youtube-dl depending on how likely it is that you will be rate-limited.
You could of course also try and set up your own, private Invidious instance and see what mileage you get from that.
yep, I was trying to make some recreations of DVD menus a few years ago and decided to host on youtube so it could be easily added to.
Iirc my hack to hide the UI was replacing pausing videos with an infinite loop of a millisecond (which was buggy as hell). VideoJS with the youtube plugin was able to hide most everything else.
Source: A similar project I made like 8 years ago.
Edit: But don't get me wrong, I like it nonetheless!