From ff0cfd53c5d08e5bdd86b5654d5b5ecb4c188657 Mon Sep 17 00:00:00 2001 From: Broque Thomas Date: Mon, 16 Feb 2026 09:25:28 -0800 Subject: [PATCH] fix 404 error due to spotify api changes --- core/spotify_client.py | 4 ++-- web_server.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/spotify_client.py b/core/spotify_client.py index 0bc1a818..e96beec7 100644 --- a/core/spotify_client.py +++ b/core/spotify_client.py @@ -657,12 +657,12 @@ class SpotifyClient: return None @rate_limited - def get_artist_albums(self, artist_id: str, album_type: str = 'album,single', limit: int = 50) -> List[Album]: + def get_artist_albums(self, artist_id: str, album_type: str = 'album,single', limit: int = 10) -> List[Album]: """Get albums by artist ID - falls back to iTunes if Spotify not authenticated""" if self.is_spotify_authenticated(): try: albums = [] - results = self.sp.artist_albums(artist_id, album_type=album_type, limit=limit) + results = self.sp.artist_albums(artist_id, album_type=album_type, limit=min(limit, 10)) while results: for album_data in results['items']: diff --git a/web_server.py b/web_server.py index c3360965..46ce2bf1 100644 --- a/web_server.py +++ b/web_server.py @@ -5349,7 +5349,7 @@ def get_artist_discography(artist_id): if spotify_available and not is_numeric_id: # Try Spotify first for alphanumeric IDs try: - albums = spotify_client.get_artist_albums(artist_id, album_type='album,single', limit=50) + albums = spotify_client.get_artist_albums(artist_id, album_type='album,single') if albums: active_source = 'spotify' print(f"📊 Got {len(albums)} albums from Spotify") @@ -6401,7 +6401,7 @@ def _generate_album_suggestions(selected_artist, search_result): print(f" target_album: '{clean_target}'") # Get artist's albums from Spotify - artist_albums = spotify_client.get_artist_albums(selected_artist['id'], limit=50) + artist_albums = spotify_client.get_artist_albums(selected_artist['id']) print(f"📊 Found {len(artist_albums)} albums for artist") album_matches = [] @@ -6499,7 +6499,7 @@ def search_match(): return jsonify({"error": "Artist ID required for album search"}), 400 # Get artist's albums and filter by query - artist_albums = spotify_client.get_artist_albums(artist_id, limit=50) + artist_albums = spotify_client.get_artist_albums(artist_id) results = [] for album in artist_albums: @@ -24983,7 +24983,7 @@ def get_spotify_artist_discography(artist_name): print(f"🎵 Found Spotify artist: {artist.name} (ID: {spotify_artist_id}, confidence: {highest_score:.3f})") # Get all albums (albums, singles, and compilations) - all_albums = spotify_client.get_artist_albums(spotify_artist_id, album_type='album,single,compilation', limit=50) + all_albums = spotify_client.get_artist_albums(spotify_artist_id, album_type='album,single,compilation') if not all_albums: return {