Spotipy ::无法获得曲目的音频功能

时间:2016-07-30 03:16:33

标签: python spotipy

我试图为多个曲目提取audio_features。我用这个:

client_credentials_manager = SpotifyClientCredentials(client_id='myid', client_secret='mysecret')
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
sp.trace=False

if len(sys.argv) > 1:
    artist_name = ' '.join(sys.argv[1:])
    results = sp.search(q=artist_name, limit=50)
    tids = []
    for i, t in enumerate(results['tracks']['items']):
        print(' ', i, t['name'])
        tids.append(t['uri'])

    start = time.time()
    features = sp.audio_features(tids)
    delta = time.time() - start
    for feature in features:
        analysis = sp._get(feature['analysis_url'])
        print(json.dumps(analysis, indent=4))
        print()

但是当我运行代码时,我得到:

features = sp.audio_features(tids)
AttributeError: 'Spotify' object has no attribute 'audio_features'

我错过了什么?谢谢!

0 个答案:

没有答案