【发布时间】:2021-10-20 16:23:56
【问题描述】:
我正在尝试使用 R 从我的 spotify 帐户中提取数据。
运行脚本时出现以下错误:
Error in token$sign(req$method, req$url): attempt to apply non-function
这是我要运行的脚本:
install.packages("spotifyr")
install.packages("ggjoy")
install.packages("httpuv")
install.packages("tidyverse")
install.packages("ggridges")
library(devtools)
library(spotifyr)
library(knitr)
library(tidyverse)
library(ggridges)
library(lubridate)
library(httpuv)
##Redirect URL http://localhost:1410/
id <- ''
secret <- ''
Sys.setenv(SPOTIFY_CLIENT_ID = id)
Sys.setenv(SPOTIFY_CLIENT_SECRET = secret)
access_token <- get_spotify_access_token()
get_my_recently_played(limit = 50) %>%
mutate(artist.name = map_chr(track.artists, function(x) x$name[1]),
played_at = as_datetime(played_at)) %>%
select(track.name, artist.name, track.album.name, played_at, track.duration_ms) %>%
kable()
yes
0
谁能帮助我找到正确的方向来解决这个错误。 提前致谢!
【问题讨论】:
-
请在reproducible example 或minimal reproducible example 中输入样本。 (1) 错误究竟发生在何处/何时? (2)
get_my_recently_played(limit = 50)长什么样子?如果是大对象,请使用dput或dput(head())提供。 -
我没有深入挖掘,但我倾向于认为 spotifyr 包坏了。例如,
get_spotify_authorization_code()所依赖的scopes()函数指向此页面:https://developer.spotify.com/documentation/general/guides/scopes/,返回 404 错误,并且看起来不再存在。