Yeah I know how to do it as a user: click the play button, the Youtube video will show up, and I’ll know the link of that video.
What I’m asking is how I can get the link of the Youtube video as a programmer. For example, I have the MBID of a recording, is there any way to get the link of the Youtube video (through an API endpoint or library…)?
I read the ListenBrainz API document and found nothing. Not sure if I missed something.
Ah, I see. That is a giant pain in the ass, fraught with all sorts of peril. YouTube doesn’t make it easy to query for music videos, so we literally call the YouTube API doing text metadata searches, which often gives bad results. But we’ve got nothing more to go on, sadly.
So, if you want to do this, you need to make your own searches against the YT Api.
I tried to do the same thing too, and searching using the YT API is the most reliable. You can also try to fetch the URLs of a recording on musicbrainz. YT links aren’t often set, but Spotify, Deezer, Apple Music, and beatport are often set when importing through harmony.
Personally I do add YT links if I find wrong mappings when exporting radios with Alistral, but I’m kinda the only one doing that…