简体   繁体   English

如何使用 spotifyr 获取艺术家的 id?

[英]How do it get id of artist using spotifyr?

I am trying to get ids of artist based on artist name, album, etc. cannot seem to find a way to do so.我试图根据艺术家姓名、专辑等获取艺术家的 id。似乎无法找到这样做的方法。 Please help me with it.请帮我解决。 I do not need the entire program spoon fed, just the part on how to return id either through album name or artist name or both.我不需要整个程序,只需要关于如何通过专辑名称或艺术家名称或两者返回 id 的部分。

All of your help is much appreciated.非常感谢您的所有帮助。

I have looked into documentation in https://cran.r-project.org/web/packages/spotifyr/spotifyr.pdf still nothing我查看了https://cran.r-project.org/web/packages/spotifyr/spotifyr.pdf 中的文档仍然没有

Example:例子:

artist = "enya"
df = spotifyr::get_artist_audio_features(artist)
names(df)
 [1] "artist_name"                  "artist_id"                    "album_id"                    
 [4] "album_type"                   "album_images"                 "album_release_date"          
 [7] "album_release_year"           "album_release_date_precision" "danceability"                
[10] "energy"                       "key"                          "loudness"                    
[13] "mode"                         "speechiness"                  "acousticness"                
[16] "instrumentalness"             "liveness"                     "valence"                     
[19] "tempo"                        "track_id"                     "analysis_url"                
[22] "time_signature"               "artists"                      "available_markets"           
[25] "disc_number"                  "duration_ms"                  "explicit"                    
[28] "track_href"                   "is_local"                     "track_name"                  
[31] "track_preview_url"            "track_number"                 "type"                        
[34] "track_uri"                    "external_urls.spotify"        "album_name"                  
[37] "key_name"                     "mode_name"                    "key_mode"                    
View(df)

You can see that field artist_id is returned.您可以看到返回了字段artist_id In this example:在这个例子中:

print(df$artist_id[1])
"6uothxMWeLWIhsGeF7cyo4"

I hope it helps.我希望它有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM