HTTP / 2成帧层中的流错误 - R脚本中的Spotify API

时间:2017-02-27 21:19:57

标签: r api curl spotify

我试图通过API从Spotify获取数据。例如,获取需要授权的曲目(https://api.spotify.com/v1/audio-features/ {id})的音频功能。

示例查询是:

search_query <- "https://api.spotify.com/v1/audio-features/6pnwfWyaWjQiHCKTiZLItr"
fromJSON(search_query, flatten = TRUE)

在此之前,我尝试通过以下方式授权我的scitpt:

spotifyKey <- "xxxxxxxxxxxxxxxxxxxx"
spotifySecret <- "zzzzzzzzzzzzzzzzzzzzzz"
spotifyEndpoint <- oauth_endpoint(NULL, "https://accounts.spotify.com/authorize", "https://accounts.spotify.com/api/token")
spotifyApp <- oauth_app("spotify", spotifyKey, spotifySecret)
spotifyToken <- oauth2.0_token(spotifyEndpoint, spotifyApp)

最后一行(spotifyToken&lt; -...)打开浏览器,我可以登录Spotify,但是有一个错误:

Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
Error in curl::curl_fetch_memory(url, handle = handle) :
  Stream error in the HTTP/2 framing layer

所以来自开头的fromJSON()说错误401.如何避免这种情况?

0 个答案:

没有答案