topi314 / LavaSrc

A collection of additional Lavaplayer/Lavalink Sources
Apache License 2.0
166 stars 54 forks source link

some playlists don't work #152

Closed llimonix closed 5 months ago

llimonix commented 11 months ago

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

topi314 commented 11 months ago

@AgutinVBoy can you look into this?

AgutinVBoy commented 11 months ago

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.

AgutinVBoy commented 11 months ago

Here's a deviant_playlist.json and regular_playlist.json.

topi314 commented 11 months ago

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

AgutinVBoy commented 11 months ago

@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 commented 11 months ago

@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

AgutinVBoy commented 11 months ago

Interesting. Thanks for the reply.

There are two solutions:

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

topi314 commented 11 months ago

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

AgutinVBoy commented 11 months ago

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.

topi314 commented 11 months ago

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

llimonix commented 11 months ago

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.

llimonix commented 10 months ago

When should I wait for the update?

topi314 commented 10 months ago

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.

llimonix commented 10 months ago

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?

topi314 commented 10 months ago

you can open pr with these changes sure

llimonix commented 10 months ago

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

topi314 commented 10 months ago

I'm not gonna download a zip from mega, if you want this fixed open a pull request instead https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests

llimonix commented 10 months ago

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

topi314 commented 10 months ago

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request

llimonix commented 10 months ago

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

llimonix commented 10 months ago

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.

topi314 commented 10 months ago

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

then next open a pull request

llimonix commented 10 months ago

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

then next open a pull request

check

topi314 commented 10 months ago

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

llimonix commented 10 months ago

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

Krispeckt commented 5 months ago

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

topi314 commented 5 months ago

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

llimonix commented 5 months ago

No, it's no longer relevant. It was fixed in some of the updates Please pay attention to a minor flaw https://github.com/topi314/LavaSrc/issues/164

Krispeckt commented 5 months ago

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?

llimonix commented 5 months ago

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

Krispeckt commented 5 months ago

image image

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

topi314 commented 5 months ago

not sure what this is supposed to mean

topi314 commented 5 months ago

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