r - 使用 spotifyr 从 Spotify Top Charts 获取数据
问题描述
我正在尝试使用 R 上的 spotifyr 包获取 2017 年所有前 200 名图表的音频功能,我尝试过:
days<- spotifycharts::chartdaily()
for (i in days) {
spotifycharts::chart_top200_daily(region = "global",days = "days[i]")
}
获得 2017 年全年的每日前 200 名,但我无法做到。有人能帮我吗?:(
解决方案
It works, if you turn days from tibble
into vector:
days <- unlist(chart_daily())
lapply(days[1:3], function(i) chart_top200_daily("global", days = i))
But it parse data badly, so there will be problems with variable names, etc:
# A tibble: 6 x 5
x1 x2 x3 note.that.these.figures.are.generated.… x5
<int> <chr> <chr> <int> <chr>
1 NA Track Name Artist NA URL
2 1 thank u, next Ariana… 8293841 https://open.spoti…
3 2 Taki Taki (with S… DJ Sna… 5467625 https://open.spoti…
4 3 MIA (feat. Drake) Bad Bu… 3955367 https://open.spoti…
5 4 Happier Marshm… 3357435 https://open.spoti…
6 5 BAD XXXTEN… 3131745 https://open.spoti…
推荐阅读
- php - Laravel 控制器存储以驼峰格式接收的数据
- python - 在 Plotly Dash 中结合 DateRangePicker 和 Dropdown
- spring-webflux - Spring Webflux HttpResponse
- java - 为什么 @OnDelete(action = OnDeleteAction.CASCADE) 在删除 InheritanceType.JOINED 时不删除父表条目
- google-cloud-platform - 虚拟机到 Google Cloud Shell 带宽费用
- python - 用于多行替换字符串的正则表达式,然后放入熊猫数据框中
- javascript - 为什么WordPress登录按钮不采用自定义recaptcha按钮响应令牌
- angular - 如何将 Metamask EventEmitter 实现到 Angular?
- android-studio - Android Studio“新”菜单错误
- javascript - JSX 选择元素似乎没有在选项上自动选择(实现“选择”)。我错过了什么吗?