Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

15.3 Finding Playlists - StopIteration Exception raised 404 Not Found #86

Open
jlousada315 opened this issue Feb 17, 2021 · 0 comments
Open

Comments

@jlousada315
Copy link

Running the following code to fetch list of playlists:

while len(playlists) < 100000:
    for word, _ in word_counts.most_common():
        if not word in words_seen:
            words_seen.add(word)
            print('word>', word)
            for playlist in find_playlists(session, word):
                if playlist['id'] in playlists:
                    dupes += 1
                elif playlist['name'] and playlist['owner']:
                    playlists[playlist['id']] = {
                      'owner': playlist['owner']['id'],
                      'name': playlist['name'],
                      'id': playlist['id'],
                    }
                    count += 1
                    for token in tokenize(playlist['name'], lowercase=True):
                        word_counts[token] += 1
            break

After a while, I get the following error:

HTTP Error for GET to https://api.spotify.com/v1/search?query=a&type=playlist&market=PT&offset=1000&limit=50 returned 404 due to Not found.

Shouldn't the code skip that request whenever this happens ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant