Closed KRTirtho closed 9 months ago
This is very strange. The API documentation says the total
is an int
. I also called the API and tested the current code with the "Regal Lily" artist as mentioned in KRTIrho/spotube#1018, it returns me an int
. Moreover, the code runs without any errors.
Maybe spotify changed the API again in the meantime the bug has been reported (?). Othewise there is no way to reproduce the problem.
So in theory, KRTirtho/spotube#1018 shouldn't happen in your case.
@KRTirtho So far, yes.
What about getting followers.total as a string and show it as string too! or stringify it! I'm not familiar with Dart, it's just a suggestion.
@armanleft the API shows the follower.total
as an int
. I think it would be better to reflect the API as good as possible. Plus, the root cause of this problem is not known.
Stringifying sounds more of a hack, tbh.
Looks like artist Image
's height and width also has the same issue. Can we use the num
type for the critical fields?
Same goes for Artist.popularity
This is strange considering the spotify API didn't seems made any changes. Maybe check the jsonString got from request, and see what's the value of map in next line is, I wonder if the dart's object from json process have any changes that may take number as double as default even the original json is straight up int
This is truely strange indeed, I clone to repo to a codespace and create a spotify api key to test it, but I got the artist response json like this:
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/7ucOhItVkxNqunNLo8AkzN"
},
"followers": {
"href": null,
"total": 220081
},
"genres": [
"anime",
"j-pixie"
],
"href": "https://api.spotify.com/v1/artists/7ucOhItVkxNqunNLo8AkzN",
"id": "7ucOhItVkxNqunNLo8AkzN",
"images": [
{
"height": 640,
"url": "https://i.scdn.co/image/ab6761610000e5ebeb093646d4d8309532b49d6e",
"width": 640
},
{
"height": 320,
"url": "https://i.scdn.co/image/ab67616100005174eb093646d4d8309532b49d6e",
"width": 320
},
{
"height": 160,
"url": "https://i.scdn.co/image/ab6761610000f178eb093646d4d8309532b49d6e",
"width": 160
}
],
"name": "fripSide",
"popularity": 49,
"type": "artist",
"uri": "spotify:artist:7ucOhItVkxNqunNLo8AkzN"
}
And the artist object is successfully created from json mapping. There are no double type value existed during the process, this is truely strange.
Dart version: 3.2.4 convert package version: 3.1.1
But according to forum posts you mentioned earlier, it seems indeed something changed in spotify backend during this period, I assume they did something unintentional of intentional to it, but changed it back at least at this moment.
The funny part is that, I can't find any way to recreate the problem in my environment with my own API key, no matter where I test it (using code or curl in different machines). While spotube on my phone will still get the same problem, which I assume still getting the json with float number.
This make me thinking, which is very unlikely and crazy, is spotify API sending different data result to client with different client ID (application), which cause certain application still getting wrong data?
The scenario might be some instance in the spotify web API cluster is running problem version of API, while newer or other nodes is running normal version of API. And while I create the API Key, it is handled by node that is normal.
This make me thinking, which is very unlikely and crazy, is spotify API sending different data result to client with different client ID (application), which cause certain application still getting wrong data?
I don't think that's what is happening. Because once you log in with your account, Spotube solely uses the access token. The client id is no longer needed or supplied for use.
The scenario might be some instance in the spotify web API cluster is running problem version of API, while newer or other nodes is running normal version of API. And while I create the API Key, it is handled by node that is normal.
Yup, this is probably the reason.
Does anyone know which attributes are affected? I currently have Images.height
, Images.width
, Followers.total
,...?
Does anyone know which attributes are affected? I currently have
Images.height
,Images.width
,Followers.total
,...?
popularity
as well
Wanted to report that this is still happening.
@Jeraimee According to spotify, this issue is currently worked on.
@Jeraimee According to spotify, this issue is currently worked on.
From the comment:
Also, our Tech folks are known for their hard work so this will be fixed in no time! Consider this issue resolved.
Yep, the issue is still present after 10 days :) Looks like their hardworking team is kinda busy for now...
This is temporarly "fixed" now in v0.13.0
thanks to @hayribakici :laughing:
Now, album.tracks
endpoint's Paging
is also infected. It says it's the limit
, but I doubt it's happening for every int
type fields
#0 _$PagingFromJson (package:spotify/src/models/_models.g.dart:523:27)
#1 new Paging.fromJson (package:spotify/src/models/paging.dart:44:57)
#2 Pages.getPage (package:spotify/src/endpoints/endpoint_paging.dart:240:20)
<asynchronous suspension>
#3 AlbumQueries.tracksOfJob.<anonymous closure> (package:spotube/services/queries/album.dart:45:11)
<asynchronous suspension>
#4 _AsyncCompleter.complete (dart:async/future_impl.dart:41:3)
<asynchronous suspension>
#5 Retryer.retryOperation (package:fl_query/src/core/mixins/retryer.dart:17:7)
<asynchronous suspension>
#6 CancelableCompleter.complete.<anonymous closure> (package:async/src/cancelable_operation.dart:425:16)
<asynchronous suspension>
artists.get("artist-id")
is throwingMaybe Spotify changed their
followers
data type to double. Although why would they count people in fractions?