1

我正在尝试获取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'

我错过了什么?谢谢!

4

0 回答 0