在尝试从Blue Note爵士音乐家Hank Mobley获取专辑发行清单时,我使用以下内容:
library(magrittr);library(httr)
releasesHM<-httr::GET("https://api.discogs.com/artists/135872/releases")
此结果没有错误,我得到了15,000的数据,但是我似乎无法识别出10项结果列表中的内容:
Response [https://api.discogs.com/artists/135872/releases]
Date: 2019-01-09 14:19
Status: 200
Content-Type: application/json
Size: 15.7 kB
discogs says我应该拥有这位歌手的每个发行的标题和年份。谁能提供解决方案/指南?
谢谢!
答案 0 :(得分:1)
输出为JSON,因此请使用包jsonlite导入:
library(jsonlite)
releasesHM <- fromJSON("https://api.discogs.com/artists/135872/releases")
您将获得包含数据的列表。
标题:
> head(releasesHM$releases$title)
[1] "The Max Roach Quartet Featuring Hank Mobley"
[2] "Mobley's Message"
[3] "Jazz Message #2"
[4] "The Jazz Message Of"
[5] "Base On Balls / Stella-Wise"
[6] "Lower Stratosphere / Reunion"
艺术家:
> head(releasesHM$releases$artist)
[1] "The Max Roach Quartet* Featuring Hank Mobley"
[2] "Hank Mobley"
[3] "Hank Mobley"
[4] "Donald Byrd, Hank Mobley, Horace Silver, Doug Watkins, John La Porta*, Ronnie Ball, Wendell Marshall, Kenny Clarke"
[5] "Hank Mobley"
[6] "Hank Mobley"