mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 08:35:49 +03:00
[GH-ISSUE #1097] Do the track IDs that spotipy fetches change over time? #654
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#654
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 @JackDyre on GitHub (May 5, 2024).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1097
I am working on a project that stores files as spotify playlists. I made a lookup dictionary between 8194 (2^13 + 2) track ids that spotipy fetched, and 13 bit binary strings plus a lone 1 and 0. I had gotten it working, but today I am started getting a key error in my dict saying that one of the IDs was not a valid key.
The ID is saved in my dict must still be valid for adding tracks since the files/playlists that were giving me the key error were "uploaded" today
After some troubleshooting, i found that the ID that spotipy was currently fetching was '7jokkQ2OZEjngxvDbRzWPs' while the id that was fetched last week was '1lIkht1mUGFKnDQss3Qk6K'. Both of them link to the same song using open.spotify.com/track/id, but the new id link does not show that is liked while the old id link does. If they somehow are different instances of the same song, sending an add to playlist request using the old ID adds the new ID.
Does the ID that spotipy fetches change over time? What is going on here?
@JackDyre commented on GitHub (May 5, 2024):
If the IDs change over time, it kinda ruins the whole project. Eventually I want to increase my list to 2^16 or even 2^17 track IDs and it wont be feasible to locate and update changed IDs with that many.
@chaffinched commented on GitHub (May 5, 2024):
They both appear to be the same track, one from the single release and the other from an EP (which admittedly appears to be the same as the single). You will often see the same for songs that are the same on the single and album release.
@JackDyre commented on GitHub (May 5, 2024):
While it says single, the 'single' still has all of the songs from the EP.
That doesn't explain why spotipy is fetching a different ID than it did when I fetched all of the IDs last week to make the lookup dict.
I am adding songs to the playlist representing a file using the IDs I fetched originally, but when I fetch all the tracks in the playlist to read the file, it returns the new ID. Either the old ID somehow adds the new track, or it's the same track but the ID that gets fetched from it is different.
@dieser-niko commented on GitHub (May 5, 2024):
How exactly do you collect your IDs? What endpoint is your source?
@JackDyre commented on GitHub (May 5, 2024):
both now and when i collected the IDs originally, I used the playlist_tracks() method and iterate while increasing the offset until ['next'] is None
@JackDyre commented on GitHub (May 5, 2024):
Here is an example:
api_request_manageris just a class that i wrote that slows down requests to 1 per second at the max and also handles the logic for splitting large numbers of track IDs into batchs for adding to playlists and iterating over the batches for fetching the tracksThat script returns
But originally when i fetched all the IDs for my lookup dict, it returned
1lIkht1mUGFKnDQss3Qk6K@dieser-niko commented on GitHub (May 5, 2024):
Ok wow, that's weird. If it bothers you, then it might help posting to the Spotify Community with your problem. But there's nothing that spotipy can fix about this.
@JackDyre commented on GitHub (May 5, 2024):
I think I figured out a solution, I can just store some sort of identifier string based of the track title and all of the artists and use that for when i convert the tracks back into binary because the that is very unlikely to change
@dieser-niko commented on GitHub (May 9, 2024):
Closing as it seems that you found a solution