mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #1502] Unable to decode dealer user collection (liked song collection) events #681
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#681
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @BenJeau on GitHub (May 27, 2025).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1502
Description
I'm creating a Spotify client to listen passively on events from Spotify. It works great for most of the events, except the
hm://collection/collection/:usernameone, which is used whenever a user adds/remove a song from their liked songs.Version
Using the latest commit,
github.com/librespot-org/librespot@8b729540f4How to reproduce
cargo runCargo.tomlmain.rs- the protobuf message used forhm://collection/collection/:usernameis certainly not the right one, but it would give another error if it reached that part (I'm also unsure which protobuf schema this would relate to):Log
My logs are extremely verbose, but I've captured where the parsing issues are logged. I removed/added/removed/added the same song
link=https://open.spotify.com/track/1kuPgsWuwfNVHTPDBGMMj4, uri="spotify:track:1kuPgsWuwfNVHTPDBGMMj4", uid="ea0019b856d6d45d2cc4"Host (what you are running
librespoton):Additional context
You can see the raw data is similar throughout the requests:
[10, 24, 8, 0, 18, 16, 43, 184, 38, 105, 23, 212, 70, 149, 146, 77, 130, 115, 44, 209, 83, 30, 40, 0, 48, 1][10, 28, 8, 0, 18, 16, 43, 184, 38, 105, 23, 212, 70, 149, 146, 77, 130, 115, 44, 209, 83, 30, 40, 191, 215, 212, 193, 6, 48, 0][10, 24, 8, 0, 18, 16, 43, 184, 38, 105, 23, 212, 70, 149, 146, 77, 130, 115, 44, 209, 83, 30, 40, 0, 48, 1](the same)[10, 28, 8, 0, 18, 16, 43, 184, 38, 105, 23, 212, 70, 149, 146, 77, 130, 115, 44, 209, 83, 30, 40, 202, 215, 212, 193, 6, 48, 0]I can see the following:
8, 0, 18, 16, 43, 184, 38, 105, 23, 212, 70, 149, 146, 77, 130, 115, 44, 209, 83, 30, 40is common, I'm guessing that the song IDUltimately, I'm unfamiliar how this works other from my exploration of this codebase.
@BenJeau commented on GitHub (May 28, 2025):
Continued my exploration, but no definitive way to parse it yet.
I think the protobuf file for this type of message would look something like
For
[10, 24, 8, 0, 18, 16, 43, 184, 38, 105, 23, 212, 70, 149, 146, 77, 130, 115, 44, 209, 83, 30, 40, 0, 48, 1], the parsed message is nowSpotifyLikeAction { tracks: [Track { status: 0, track_id_binary: [43, 184, 38, 105, 23, 212, 70, 149, 146, 77, 130, 115, 44, 209, 83, 30], context_field: None }], timestamp: 0, action_type: false }Steps to convert those binary track_id bytes to the Spotify ID:
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZalphabet1kuPgsWuwfNVHTPDBGMMj4which is the correct Spotify ID!Other things I found out/confirmed:
repeated Track tracks).48byte and the40byte before it represents the timestamp in seconds@photovoltex commented on GitHub (May 28, 2025):
Interesting discoveries! But what exactly is your issue you encounter? Is it something rudimentary in the implementation or rather a missing protobuf definition?
From your log there is a
WireErrorand abaes64error/warning, but I can't tell which of those you refer to.You also use
ClusterUpdateas parsing for the collection event, which is usually used for the connect device communication if I'm remember right. So maybe that's the issue, which wouldn't be directly a library issue, right?If so I would convert this issue into a discussion, so we can still help you but without declaring non existing proto files as bug^^;
@BenJeau commented on GitHub (May 29, 2025):
Sorry for opening an issue if this isn't considered an issue. Yes it is about the parsing of the data from the
hm://collection/collection/:usernameevents, I saw it as an issue as the other events didn't have any issue with parsing. I do not know exactly what is the issue, I have a hunch is more complex than just a missing protobuf definition, but I think it is missing a protobuf definition and I could be wrong.I'm aware that
ClusterUpdateisn't the right message format for this, but decided to just put anything there as the errors without it weren't descriptive. In the code itself, theWireErrorandbase64error comes from the same place (if my memory serves well), just logged/returned differently.Feel free to convert this as a discussion, I do not mind :)
On another topic, if you know how to "acquire" or extract the protobuf definitions from a Spotify binary, let me know! Either here or at my email
with-vorbisandwith-tremorfeatures #1057