Search if an answer is already available: No
1. Summarize the problem
Spotify introduced the ability to fetch information about podcasts and shows. Details here.
I am using the Python "requests" package to generate the request URL to get metrics like no_of_followers and so on (I am not sure if they're available for podcasts), so I tried getting metadata for a show.
The endpoint I used to get information about a show: GET https://api.spotify.com/v1/shows/{id}
headers = {
"Authorization": f"Bearer {access_token}"
}
# endpoint used "https://api.spotify.com/v1/shows/{id}"
lookup_url = "https://api.spotify.com/v1/shows/3IM0lmZxpFAY7CwMuv9H4g" #"The Daily" podcast example
print(lookup_url)
r = requests.get(lookup_url, headers=headers)
print(r)
print(r.status_code)
print(r.json())
However I receive the following error response:
https://api.spotify.com/v1/shows/3IM0lmZxpFAY7CwMuv9H4g
<Response [404]>
404
{'error': {'status': 404, 'message': 'non existing id'}}
Questions at the end
2. Describe what you’ve tried
I tried pulling similar information using the search endpoint, there, I do get a valid response. Informative and as expected when searching for artists but the response data seems to be missing for the show I searched.
The endpoint I used to search for a show/artist: GET https://api.spotify.com/v1/search
Using the search endpoint to find information about a show/artist:
headers = {
"Authorization": f"Bearer {access_token}"
}
endpoint = "https://api.spotify.com/v1/search"
data = urlencode({"q":"the daily","type":"show"})
# data = urlencode({"q":"drake","type":"artist"})
lookup_url = f"{endpoint}?{data}"
print(lookup_url)
r = requests.get(lookup_url, headers=headers)
print(r.status_code)
r.json()
Get the output for the show above as:
https://api.spotify.com/v1/search?q=the+daily&type=show
200
{'shows': {'href': 'https://api.spotify.com/v1/search?query=the+daily&type=show&offset=0&limit=20',
'items': [None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None],
'limit': 20,
'next': 'https://api.spotify.com/v1/search?query=the+daily&type=show&offset=20&limit=20',
'offset': 0,
'previous': None,
'total': 14755}}
If I try to search information for an artist, I get good results:
{'artists': {'href': 'https://api.spotify.com/v1/search?query=drake&type=artist&offset=0&limit=20',
'items': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3TVXtAsR1Inumwj472S9r4'},
'followers': {'href': None, 'total': 48844145},
'genres': ['canadian hip hop',
'canadian pop',
'hip hop',
'pop rap',
'rap',
'toronto rap'],
'href': 'https://api.spotify.com/v1/artists/3TVXtAsR1Inumwj472S9r4',
'id': '3TVXtAsR1Inumwj472S9r4',
'images': [{'height': 640,
'url': 'https://i.scdn.co/image/60cfab40c6bb160a1906be45276829d430058005',
'width': 640},
{'height': 320,
'url': 'https://i.scdn.co/image/5ea794cf832550943d5f8122afcf5f23ee9d85b7',
'width': 320},
{'height': 160,
'url': 'https://i.scdn.co/image/8eaace74aaca82eaccde400bbcab2653b9cf86e1',
'width': 160}],
'name': 'Drake',
'popularity': 98,
'type': 'artist',
'uri': 'spotify:artist:3TVXtAsR1Inumwj472S9r4'},
...output clipped for readability
3. Questions:
- Am I trying to pull information about a show incorrectly? I tried to use the search endpoint as mentioned below - which seems to work well for artists or tracks but not for shows.
- Is it possible to get metrics for a show - like followers, times_episodes_played and historic data?
Thanks for your help.