Open chrirauch opened 2 years ago
Thanks for providing this code snippet. Do you know how the song_url
property is being calculated or parsed? It looks like it's probably coming from the ytdl-core
package, and not the YouTube API. I wonder if it's being scraped from the web page or network requests from the youtube.com web pages.
Hi,
Unfortunately no. Didn't find this in the official api docs. I just stumbled upon this while looking for a way to get better results from youtube links. But i will have a look at the ytdl-core package when i find some time. It looks like it's not a huge package and hopefully it shouldn't be too much hassle to find out where they get it from.
Will report back when i found something. But it'll probably be on the weekend, as my schedule during the week is quite packed
It looks like they scrape it from the webpage. In the case of the union13 song https://www.youtube.com/watch?v=ILWBMmgmTj4 i found some references in the html source code to the working url (https://www.youtube.com/watch?v=q6pV6nceHR4). For example the song name in the more info section is linked to the url that ytdl-core returns as song_url
Hi there
First of all, thanks for your great service. I'm using your public api for a personal signal bot. Basically we have a group in which we paste YouTube links to songs or music videos which I send to your api and return the song.link url.
I found out that a lot of those results where only links to YouTube and YouTube music are generated, can be circumvented by passing the song_url metadata value to the song.link api instead of the original url.
Thought I leave it here because you could probably use that internally to link together different urls of YouTube music videos
I don't know how you would get this with a regular api call, but the ytdl-core package returns it and I guess it shouldn't be too hard to figure out where they get this info if you are interested
I made a small demo on runkit
In the demo, 3 out of 4 urls work after passing the url from the metadata instead of the original url, the last one (Eric Clapton - cocaine) has no song_url property https://runkit.com/chrirauch/songurl