问题描述
搜索答案是否可用:否
1。总结问题
Spotify引入了获取有关播客和节目信息的功能。 Details here.
我正在使用Python“请求”包生成请求URL,以获取诸如no_of_followers之类的指标,等等(我不确定它们是否可用于播客),所以我尝试获取节目的元数据。
我用来获取有关演出的信息的端点: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())
但是我收到以下错误响应:
https://api.spotify.com/v1/shows/3IM0lmZxpFAY7CwMuv9H4g
<Response [404]>
404
{'error': {'status': 404,'message': 'non existing id'}}
最后的问题
2。描述您尝试过的事情
我尝试使用搜索端点提取类似的信息,在那里,我得到了有效的响应。搜索艺术家时内容丰富,符合预期,但我搜索的节目似乎缺少响应数据。
我用来搜索演出/艺术家的端点:GET https://api.spotify.com/v1/search
使用搜索端点查找有关演出/艺术家的信息:
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()
获取以上节目的输出:
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],'limit': 20,'next': 'https://api.spotify.com/v1/search?query=the+daily&type=show&offset=20&limit=20','offset': 0,'previous': None,'total': 14755}}
如果我尝试搜索艺术家的信息,则会获得不错的结果:
{'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。问题:
- 我是否试图错误地获取有关演出的信息?我尝试使用如下所述的搜索端点-似乎对艺术家或曲目很有效,但对于演出却不起作用。
- 是否可以获取节目的指标,例如关注者,times_episodes_played和历史数据?
感谢您的帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)