I am trying to extract Spotify data via the API
Using the below getAlbums
Function:
getAlbums <- function(id,type="album",market="US") {
total <- jsonlite::fromJSON(paste0("https://api.spotify.com/v1/artists/",id,"/albums??&album_type=album"))$total
req <- jsonlite::fromJSON(paste0("https://api.spotify.com/v1/artists/",id,"/albums??offset=0&limit=",total,"&album_type=",type,"&market=",market))
return(req$items[,c("id","name","album_type","available_markets")])
}
I am getting the below error:
Error in open.connection(con, "rb") : HTTP error 400 Extracting Spotify Data
whereas i can successfully Authenticate for other parameters.