1

我尝试使用以下内容从 Blue Note 爵士音乐家 Hank Mobley 获取专辑发行列表:

library(magrittr);library(httr)
releasesHM<-httr::GET("https://api.discogs.com/artists/135872/releases")

这个结果没有错误,我得到了 15k 的数据,但我似乎无法识别 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 说我应该知道这位艺术家每次发行的标题和年份。谁能提供解决方案/指导?

谢谢!

4

1 回答 1

2

输出是 JSON 格式,所以使用 package 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" 
于 2019-01-09T15:26:02.747 回答