我一直在尝试使用Soundcloud API嵌入音轨,但我一直在努力:
'资源'对象没有属性'__getitem __'
问题出在embed_info ['html']中,但我不知道如何修复它。
def downloadgate(request):
# create a client object with your app credentials
client = soundcloud.Client(client_id='Client_id')
# get a tracks oembed data
track_url = 'http://soundcloud.com/daomusic/preview'
embed_info = client.get('/oembed', url=track_url)
embed_info = embed_info['html']
# print the html for the player widget
return render(request, 'rango/downloadgate.html', {'embed_info' : embed_info})