topi314 / LavaSrc

A collection of additional Lavaplayer/Lavalink Sources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

some playlists don't work

llimonix opened this issue · comments

there are playlists that provide shortened track information in the Yandex Music API. I have processed this in my script. In your case, he just doesn't see the tracks.

Playlist: https://music.yandex.ru/users/Comicona/playlists/1023

I did this. Made a request with MarshalX YandexMusic API: https://github.com/MarshalX/yandex-music-api

Copied all the id:album_id from the response to client.user_playlist("kind="1023", user_id="Comicona")

And sent a list consisting of a set of data

id:album_id

On request, client.tracks(list_track)

I received these tracks with full information. I tried it on a playlist with 500+ tracks, everything comes correctly

commented

@AgutinVBoy can you look into this?

Wow. The API response for this playlist is different. For a normal playlist, a json is returned with the content: "result.tracks[].track.{title, id, artists etc}".
I haven't seen the format for the provided playlist before. Api returns: "result.tracks[].{id, albumId}".

We need to modify the code: fetch information about each track when such format is found.
I didn't find any other differences in the API response.

commented

That looks awful
Is there any indication when which is returned?

@llimonix, how did you create a playlist like this?

The only option I can offer now is to create several playlists of different types and deeply analyze the API response to these playlists.

@llimonix, how did you create a playlist like this?

The only option I can offer now is to create several playlists of different types and deeply analyze the API response to these playlists.

I took a regular request for a playlist where kind (1023) is passed and user_id (Comicona) got an abbreviated view of the tracks:

image

Then I took and made a request with a combination of all track_id:album_id per request: https://api.music.yandex.net/tracks?trackIds=82876164%2C86356254%2C80782933%2C83291070%2C86726809%2C84019953%2C87706317%2C66781909%2C85740709%2C85815221 - where %2C is a comma (Instead of a bundle, track_id:album_id accepts just an id. But for correctness, it is better to use the first option and everything works correctly for me)

And I got the full view of the tracks.

image

Tested on 500+ tracks in the album, it accepts apparently any long list

Interesting. Thanks for the reply.

There are two solutions:

  • Solution 1. YandexMusicSourceManager, line 161. If var tracks is empty, then check the first element in json.result[] for the "track" key. If it is missing, then execute the query https://api.music.yandex.net/tracks?trackIds=<id of tracks separated by commas>. Then call this.parseTracks(json.result[]) method.
  • Solution 2: YandexMusicSourceManager, line 155. Check the first element in json.result[] for the "track" key. If it is missing, then execute the query https://api.music.yandex.net/tracks?trackIds=<id of tracks separated by commas>. Then call this.parseTracks(json.result[]) method. If the "track" key is present, continue normal code execution.

@topi314, take a look at this. What do you think?

commented

Either will do the job I suppose
What I'm more worried about is how many tracks can you load at once?
There surely will be maximum

The maximum length of the request (or rather arguments separated by comma) is 6560 characters (I found out experimentally. After that I get error 431). The average track id length is 10 characters (including comma).
I think for safety we can make several requests, separating 300-500 tracks each.

commented

sounds good to me, for safety you could simply check the query length and paginate from there

The maximum length of the request (or rather arguments separated by comma) is 6560 characters (I found out experimentally. After that I get error 431). The average track id length is 10 characters (including comma). I think for safety we can make several requests, separating 300-500 tracks each.

I did 500+ and it worked for me.

When should I wait for the update?

commented

This issue is up for someone to grab and fix.

I personally don't use Yandex and therefore don't really have interest to look into when I'm busy with other stuff.

This issue is up for someone to grab and fix.

I personally don't use Yandex and therefore don't really have interest to look into when I'm busy with other stuff.

can I recompile the plugin with a fix myself, or can I send you an updated file for Yandex and you compile it yourself?

commented

you can open pr with these changes sure

https://mega.nz/folder/fy4CgKRT#VuXGCKVatNGTAZ8581pgjw

I made a parse of bad playlists in my own way

First, he tries to get the tracks in the usual way, if nothing is included in the list, he parses through another link described above.

A pack of 300 tracks each. If there are not 300 tracks, then he immediately makes a request for all the IDs

I also set the limit of songs on the artist's link to 300, previously there were 10. It is not clear why. If the artist has less than 300 tracks, he will also parse everything correctly
image

I'm not good at github and what to do here. So it's your right to use or not. The main thing is that everything works for me, and the rest is not important

I made a fork of the project, you can see all the changes

although now I understand that that If else if check could have been done without checking for the number of tracks. He would have divided the chunks normally if there were less than the specified number.

commented

I made a fork of the project, you can see all the changes

then next open a pull request

I made a fork of the project, you can see all the changes

then next open a pull request

check

commented

I'll take a look later & leave feedback in the pull request

I will add another text search fix in 2024. Instead of searching only for a track, the most appropriate option will be selected, whether it is a track, playlist or album. I rewrote the logic a bit and slightly fixed erroneous attempts to process json when it did not exist

Is it still relevant? If so, can I get a couple of links to such playlists?

commented

There was some sort of misunderstanding on what exactly they wanted
Check the linked pr above

No, it's no longer relevant. It was fixed in some of the updates
Please pay attention to a minor flaw
#164

No, it's no longer relevant. It was fixed in some of the updates

Please pay attention to a minor flaw

Meaning with the plugin fix or yandex music api?

No, it's no longer relevant. It was fixed in some of the updates
Please pay attention to a minor flaw

Meaning with the plugin fix or yandex music api?

plugin

image
image

Xd, and you should have just read the documentation and not made anything up

commented

not sure what this is supposed to mean

commented

since this seems to be resolved I am gonna close this issue