Announcements

Help Wizard

Step 1

NEXT STEP

Episodes API not returning data

Episodes API not returning data

I'm not getting episode info back from the API. 

 

Are others seeing this? I tried using ids from the docs as well as ones I'm pulling off of urls.

 

I tried hitting the API directly and through spotipy like so:

 

import spotipy
from spotipy.oauth2 import SpotifyClientCredentials

auth_manager = SpotifyClientCredentials()
sp = spotipy.Spotify(auth_manager=auth_manager)

episodes = sp.episodes(["512ojhOuo1ktJprKbVcKyQ"])

print("Got episodes:", episodes) # Got episodes: {'episodes': [None]}

 

 

Thanks for your help! 

Reply
1 Reply

Ah, looks like this is a token issue. 

 

When I generate a token from the Spotify dev console and inject that into a request, it works.

 

Not sure how to properly generate a token in code. The follow gives me a token that doesn't work for the episodes endpoint:

res = requests.post("https://accounts.spotify.com/api/token", data={
    "grant_type": "client_credentials"
}, headers={
    'Authorization': 'Basic ' + base64.b64encode((SPOTIFY_CLIENT_ID + ":" + SPOTIFY_CLIENT_SECRET).encode()).decode(),
    "Content-Type": "application/x-www-form-urlencoded"
})

 

Any of y'all know what might be my issue? Thanks!

Suggested posts

Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

ModeratorStaff / Moderator/ 4 years ago  in Social & Random