在Python中运行音频功能Spotify时出错

时间:2019-02-27 08:07:47

标签: python spotify

打扰一下,我有一个项目,可以从Spotify获取带有代码的歌曲

for Playlist in playlists:
    individual_songs = []
    for uri in playlists[Playlist]:
        username = uri.split(':')[2]
        playlist_id = uri.split(':')[4]
        offset = 0
        results = sp.user_playlist_tracks(username, playlist_id)
        individual_songs += [i['track']['uri'] for i in results['items']]

        while (results['next'] != None):
              offset += 100
              results = sp.user_playlist_tracks(username, playlist_id, offset=offset)
              individual_songs += [i['track']['uri'] for i in results['items']]

Features_music = []
print ("[  Songs  ] Mencari nilai fitur untuk setiap lagu...")
amount = len(individual_songs)
count = 0
for track in individual_songs :
    print ("\r[  Songs  ] " + str(round((count/amount)*100, 2)) + "%\t", end='')
    count += 1
    features = sp.audio_features(track)
    pop = sp.track(track)
    for song in features:
        if song != None:
        Features_music.append(song)

但是我有一条错误消息

    C:\WinPython\python-3.6.3.amd64\lib\site-packages\spotipy\client.py in _get_id(self, type, id)
    848             if type != fields[-2]:
    849                 self._warn('expected id of type %s but found type %s %s',
--> 850                            type, fields[-2], id)
    851             return fields[-1]
    852         fields = id.split('/')
    TypeError: _warn() takes 2 positional arguments but 5 were given

有人知道我的问题的解决办法吗?

0 个答案:

没有答案