Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some playlists don't work #152

Closed
llimonix opened this issue Dec 4, 2023 · 33 comments
Closed

some playlists don't work #152

llimonix opened this issue Dec 4, 2023 · 33 comments
Assignees
Labels
bug Something isn't working

Comments

@llimonix
Copy link

llimonix commented Dec 4, 2023

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
Copy link
Owner

topi314 commented Dec 4, 2023

@AgutinVBoy can you look into this?

@topi314 topi314 added the bug Something isn't working label Dec 4, 2023
@AgutinVBoy
Copy link
Contributor

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
Copy link
Contributor

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

@topi314
Copy link
Owner

topi314 commented Dec 5, 2023

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

@AgutinVBoy
Copy link
Contributor

@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
Copy link
Author

llimonix commented Dec 5, 2023

@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
Copy link
Contributor

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?

@topi314
Copy link
Owner

topi314 commented Dec 7, 2023

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
Copy link
Contributor

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
Copy link
Owner

topi314 commented Dec 7, 2023

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

@llimonix
Copy link
Author

llimonix commented Dec 7, 2023

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
Copy link
Author

When should I wait for the update?

@topi314
Copy link
Owner

topi314 commented Dec 30, 2023

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
Copy link
Author

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
Copy link
Owner

topi314 commented Dec 30, 2023

you can open pr with these changes sure

@llimonix
Copy link
Author

llimonix commented Dec 30, 2023

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
Copy link
Owner

topi314 commented Dec 30, 2023

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
Copy link
Author

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

@llimonix
Copy link
Author

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

@llimonix
Copy link
Author

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
Copy link
Owner

topi314 commented Dec 30, 2023

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

then next open a pull request

@llimonix
Copy link
Author

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

then next open a pull request

check

@topi314
Copy link
Owner

topi314 commented Dec 30, 2023

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

@llimonix
Copy link
Author

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
Copy link
Contributor

Krispeckt commented May 14, 2024

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

@topi314
Copy link
Owner

topi314 commented May 14, 2024

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

@llimonix
Copy link
Author

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

@Krispeckt
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

image
image

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

@topi314
Copy link
Owner

topi314 commented May 16, 2024

not sure what this is supposed to mean

@topi314
Copy link
Owner

topi314 commented May 16, 2024

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

@topi314 topi314 closed this as completed May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants