tamland / python-tidal

Python API for TIDAL music streaming service
GNU Lesser General Public License v3.0
406 stars 110 forks source link

The API doesn't return the correct number of favorites #143

Closed dgiglio closed 1 year ago

dgiglio commented 1 year ago

Hi, I'm playing with the APIs and I've noticed that I cannot extract the full set of my favourite artists. I've compared the cardinality of the set returned by my code with one from a service as, i.e. Soundiiz and the latter is significantly bigger.

However, my code is very simple:

    def getFavouriteArtists(self):
    lartists = []
    subset = []
    page = 1000
    offset = 0

    subset = tidalapi.user.Favorites(self.session,XXXXXXXXX).artists()
    lartists = subset

    while len(subset) == page:
        offset += page
        subset = tidalapi.user.Favorites(self.session,XXXXXXXXX).artists(page, offset)
        lartists.extend(subset)

    return lartists

I know that each call has a paging limit of 1000, so I make a first call and I check its result set size, if it matches the paging limit it's very likely I have to iterate further, and I keep doing until I get a smaller set, then the function returns.

Moreover, I get the wrong result at the very fist call (the total is less than 1000 items) so it looks like the issue lies elsewhere.

Any clue? Thanks in advance.

WilliamGuisan commented 1 year ago

Hello! After quickly getting my favorite artists to try recreate the issue l can not say that the same is true for me. I got 78 entries in the list, which is the exact amount of artists i added to the favorites.

I do also not think that your code is the problem, however the maximum limit for getting your favorite artists per call is not 1'000, it is 10'000.

Maybe your results from Soundiiz are the faulty ones? I have made the same mistake before, comparing two numbers and assuming the bigger must be the correct one, when it turned out the bigger list actually contained duplicates. I'd recommend checking the Soundiiz results if you haven't done so yet!

Sadly i can't make out any other issues, since i can not recreate the problem :/

dgiglio commented 1 year ago

Sadly i can't make out any other issues, since I can not recreate the problem :/

Hi, WIlliam first of all, thanks for your reply. I'll investigate further and try to collect more informations. Best regards.

Daniele

tehkillerbee commented 1 year ago

I have never had this issue myself.

Since there has been no updates from OP, I will close this issue. Feel free to reopen if necessary.