Closed Artholos closed 6 months ago
Generally a good idea. I think it would be best to use JSON schemas and have them as python objects.
But I'm not sure if the OpenAPI definition from Spotify is actually representing the API correctly. If I'm not mistaken, there is/was actually a flaw in the definition, but I'll have to check that again sometime.
Edit: found a related issue: https://github.com/spotipy-dev/spotipy/issues/975
I'm currently going through some issues and I'm realizing that I probably commented on the wrong issue. Do you still need help or can we close this here?
Oh heyo, I'm so sorry, I totally forgot. I couldn't find a work around to the issue so I gave up and went to do something else. It looks like you found the related problem, so I think we're good to close this issue.
Thanks so much!
It looks like you found the related problem
Yeah no, that's the thing. The related issue doesn't seem to be related to your issue.
Alright then, I've dug up the program and the issue is still happening, probably because I haven't changed anything yet. What do you suggest?
I've spotted two issues. The first one is here:
...
if The_G == 'any':
playlist_id = '37i9dQZEVXbMDoHDwVN2tF'
else:
playlists = sp.category_playlists(category_id=The_G, country=The_C, limit=1)
playlist_id = playlists["playlists"]["items"][0]["id"]
- results = sp.playlist(playlist_id, fields="tracks.items(track(name, artists(name)))")
+ results = sp.playlist(playlist_id, fields="tracks.items(track(id, name, artists(name)))")
print(f"Results found: \n\n{results}")
print(f"Building Arrays...")
...
It seems that you've filtered out the ID.
The second one here:
...
for i in range(EyeLimit):
song_names.append(results["tracks"]["items"][i]["track"]["name"])
- song_ids.append(results["tracks"]["items"][i]["id"])
+ song_ids.append(results["tracks"]["items"][i]["track"]["id"])
artist_names.append(results["tracks"]["items"][i]["track"]["artists"][0]["name"])
...
I think that one's self explanatory.
おh thank you! I can't believe I missed those haha! I suppose a second set of eyes really makes all the difference. I'm getting a completely new error now down in the database part. Looks like I have a project again! Thank you so much for your help :D
Describe the bug Querying Spotify for song details is not returning with the 'Track ID'. Here's my code to search for popular songs in various genres. I need three details about each track: Name, artist, and track ID. But the track ID is not being returned. According to the documentation on https://developer.spotify.com/documentation/web-api/reference/search shows that the track ID located in: 'tracks > items > id'
Here's my function that returns list of top 10 songs in a genre:
Expected behavior I expect that the track ID would be returned so it can be used later in other Spotify API calls.
Output
Environment: