jaedb / Iris

Discover, explore and manage your music library across multiple sources with this beautiful web-based interface. Iris is a Mopidy frontend extension.
Apache License 2.0
1.13k stars 131 forks source link

Spotify UI does not list all artists #703

Closed adq closed 10 months ago

adq commented 3 years ago

Describe the bug I have Spotify Premium, and I have added the necessary keys etc to both mopidy.conf and to the user interface (so the UI says spotify is "Authorized".

However, the list of artists in the "Artists" tab for Spotify doesn't show everything. Looking at the Chrome network tab I see the following two requests as soon as I hit "refresh" on the Artists page:

https://api.spotify.com/v1/me/following?type=artist&limit=50&refetch=1613824413902
https://api.spotify.com/v1/me/following?type=artist&limit=50&refetch=1613824413902

(The second one takes a lot shorter and says "Failed to load response data" Not sure why there are two, one of which fails)

Anyway, looking at the first (successful) request, I see:

{ artists: {items: [{external_urls: {spotify: "https://open.spotify.com/artist/YYYY"},…},…],…}
  cursors: {after: "XXXXX"}
  href: "https://api.spotify.com/v1/me/following?type=artist&limit=50"
  items: [{external_urls: {spotify: "https://open.spotify.com/artist/YYY"},…},…]
  limit: 50
  next: "https://api.spotify.com/v1/me/following?type=artist&after=YYY&limit=50"
  total: 97
}

(I've replaced any tokeny things with XXXX/YYYY)

See that total: 97? I'd expect another request to happen to retrieve the rest of them. I'm only seeing the first 50. Maybe that's what the second (failing) one is attempting to do?

In the Albums tab, on refresh, however, I do see multiple requests as its downloads each page of results for the GUI from api.spotify.com.

To Reproduce Steps to reproduce the behavior:

  1. Enable Test Mode (Settings > Debug > Test Mode). This provides more verbose error logs.
  2. Setup Spotify Premium (have have more than 50 followed artists)
  3. Click on 'Artists'
  4. Click 'Refresh'
  5. Count the number of rows + columns shown and multiply them (== 50 exactly)
  6. Send bug report :)

Expected behavior To see all the artists.

Console log

Force-refetching "mopidy:library:artists"
instrument.js:109 Force-refetching "spotify:library:artists"
instrument.js:109 Loading more: 50

Environment details:

jaedb commented 3 years ago

When looking at those 'duplicate' requests, I would expect one to be an OPTIONS request, and the other a GET request. It could also be due to the ServiceWorker wrapper (if you're running behind a SSL proxy). Can you confirm whether either is the case?

OPTIONS vs GET (Firefox): image

ServiceWorker (Chrome): image

It is worth noting that all views in Iris are lazy-loaded to limit the number of React components on the page. This number is also 50. The console.log('Loading more: 50') indicates the next batch to be loaded is being revealed.

So the upshot is that you have counted all rows in the table and there are only 50? Is this a manual count or using an element count (ie something like document.getElementsByClassName("list artists")[0].children.length)? I haven't been able to replicate this.

Have you got any filters applied on the view?

adq commented 3 years ago

I counted the number of rows and columns shown on the table with my eyeballs. there were 10x5 and all cells were filled.

Oh also, no SSL proxy involved.

I'll do some more investigation later.

adq commented 3 years ago

Hey, yup, you're right, one is OPTIONS and one is a GET request.

However, I still cannot get it to load more than 50 artists:

network tab says:

following?type=artist&limit=50&refetch=1614026053257 | 200 |   | Other | 0 B | 36 ms
-- | -- | -- | -- | -- | --
following?type=artist&limit=50&refetch=1614026053257 | 200 | fetch | VM21:1 | 8.7 kB | 54 ms

(once again, I can see it thinks I have 101 artists, which matches the requests in Spotify's own web interface, which calls the same API URL.. I've added a few since last time which is why it is greater)

console says:

instrument.js:109 Loading more: 50

network tab is unchanged: ie no new requests.

Just in case my adblocker is screwing it up, I've tried it in incognito mode as well. Exactly the same behaviour.

What can I do now to help debug this?

jaedb commented 3 years ago

The "Loading more" message was relevant when lazy rendering big lists to avoid performance issues. I completely overhauled this a few months back in 3.57.0 so the best course of action is to upgrade to the latest version and see if this fixes your issue. Please be sure to clear your browser cache.

jaedb commented 10 months ago

Closing this issue; there have been many improvements since 2021 so I trust this issue is now resolved. Please request this issue is reopened if it is still relevant.