404 not found exception on GetSimilarArtists
Closed this issue · 2 comments
Offbeatmammal commented
just wondering if something has changed in the SpotifyAPI? this code was working on Friday, but today I'm getting an exception:
require_once 'vendor/autoload.php';
$session = new SpotifyWebAPI\Session('?????','?????');
$session->requestCredentialsToken();
$accessToken = $session->getAccessToken();
$api = new SpotifyWebAPI\SpotifyWebAPI();
$api->setAccessToken($accessToken);
....
$artist = "6eUKZXaKkcviH0Ku9w2n3V"; // Should be Ed Sheeran
$artists = $api->getArtistRelatedArtists($artist);
this now throws:
Uncaught SpotifyWebAPI\SpotifyWebAPIException: Not Found in C:\...\vendor\jwilsson\spotify-web-api-php\src\Request.php:46
Stack trace: #0 C:\...\vendor\jwilsson\spotify-web-api-php\src\Request.php(250): SpotifyWebAPI\Request->handleResponseError('{"error": {"sta...', 404)
#1 C:\...\vendor\jwilsson\spotify-web-api-php\src\Request.php(138): SpotifyWebAPI\Request->send('GET', 'https://api.spo...', '', 'HTTP/2 404 \ncon...')
#2 C:\...\vendor\jwilsson\spotify-web-api-php\src\SpotifyWebAPI.php(122): SpotifyWebAPI\Request->api('GET', '/v1/artists/0Tn...', Array, Array)
#3 C:\...\vendor\jwilsson\spotify-web-api-php\src\SpotifyWebAPI.php(768): SpotifyWebAPI\SpotifyWebAPI->sendRequest('GET', '/v1/artists/0Tn...')
#4 C:\...\spotify_artist.php(409): SpotifyWebAPI\SpotifyWebAPI->getArtistRelatedArtists('0TnOYISbd1XYRBk...')
#5 {main} thrown in C:\...\vendor\jwilsson\spotify-web-api-php\src\Request.php on line 46
other calls, eg $results = $api->search(str_replace(" ","+","Ed Sheeran"), 'artist'); are still working fine
jwilsson commented
Hello!
I'm afraid this sounds like you've been affected by the recent changes made by Spotify to certain APIs, including "get related artists" 😕
Offbeatmammal commented
ugh, that sucks. this is a pre-existing app, but I guess Spotify don't really care. thanks for pointing that out, guess we'll just deprecate Spotify support in favour of Last.FM relatedArtists