Build Status AppVeyor Build Status codecov CRAN_Status_Badge

WORK IN PROGRESS

lastfmr is an R interface to Last.fm.

Get API Key

Sys.setenv(lastfm_key = "yourAPIKey")

Examples

Get user’s top 5 artists

library(lastfmr)
top5 <- user_getTopArtists("platyjus", limit = 5)
## No encoding supplied: defaulting to UTF-8.
## Observations: 5
## Variables: 10
## $ mbid             <chr> "6655955b-1c1e-4bcb-84e4-81bcd9efab30", "69d9df…
## $ url              <chr> "https://www.last.fm/music/%C3%93lafur+Arnalds"…
## $ playcount        <chr> "479", "379", "321", "309", "305"
## $ name             <chr> "Ólafur Arnalds", "Leon Bridges", "::M∆DE::IN::…
## $ streamable       <chr> "0", "0", "0", "0", "0"
## $ `@attr.rank`     <chr> "1", "2", "3", "4", "5"
## $ image.extralarge <chr> "https://lastfm-img2.akamaized.net/i/u/300x300/…
## $ image.large      <chr> "https://lastfm-img2.akamaized.net/i/u/174s/2a9…
## $ image.medium     <chr> "https://lastfm-img2.akamaized.net/i/u/64s/2a96…
## $ image.small      <chr> "https://lastfm-img2.akamaized.net/i/u/34s/2a96…
## [1] "Ólafur Arnalds"        "Leon Bridges"          "::M∆DE::IN::HEIGHTS::"
## [4] "Kendrick Lamar"        "Anderson .Paak"

Get album information

fearfun <- album_getInfo("Father John Misty", "Fear Fun")
## No encoding supplied: defaulting to UTF-8.
## Observations: 1
## Variables: 12
## $ name             <chr> "Fear Fun"
## $ artist           <chr> "Father John Misty"
## $ mbid             <chr> "da07a173-bf3d-4e7e-995d-ce473ce83030"
## $ url              <chr> "https://www.last.fm/music/Father+John+Misty/Fe…
## $ image.extralarge <chr> "https://lastfm-img2.akamaized.net/i/u/300x300/…
## $ image.large      <chr> "https://lastfm-img2.akamaized.net/i/u/174s/249…
## $ image.medium     <chr> "https://lastfm-img2.akamaized.net/i/u/64s/2496…
## $ image.small      <chr> "https://lastfm-img2.akamaized.net/i/u/34s/2496…
## $ listeners        <chr> "272899"
## $ playcount        <chr> "5422458"
## $ tracks           <list> [<data.frame[12 x 9]>]
## $ tags             <list> [<data.frame[5 x 2]>]
fearfun$tracks[[1]][, c("name", "duration")]
##                                    name duration
## 1                   Funtimes in Babylon      219
## 2                     Nancy From Now On      235
## 3      Hollywood Forever Cemetery Sings      188
## 4                   I'm Writing a Novel      215
## 5  O I Long to Feel Your Arms Around Me      143
## 6              Misty's Nightmares 1 & 2      193
## 7             Only Son of the Ladiesman      249
## 8                 This Is Sally Hatchet      237
## 9        Well, You Can Do It Without Me      163
## 10     Now I'm Learning to Love the War      257
## 11                        Tee Pees 1-12      196
## 12           Everyman Needs a Companion      319