Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_artist_audio_features() fails to work on some artists due to preview_url #202

Open
tnieuwe opened this issue Sep 19, 2024 · 3 comments

Comments

@tnieuwe
Copy link

tnieuwe commented Sep 19, 2024

Hello,

Not sure if this is related to the CRAN removal, but there is an issue with the get_artist_audio_features() function with certain artists for me. For example running:
cur_artist_features <- get_artist_audio_features("Alex G")
Works fine, but running:
cur_artist_features <- get_artist_audio_features("Modest Mouse")
Returns the following error:

Error in `map()`:
i In index: 6.
Caused by error in `dplyr::rename()`:
! Can't rename columns that don't exist.
x Column `preview_url` doesn't exist.
Backtrace:
  1. spotifyr::get_artist_audio_features(cur_artist)
 11. dplyr:::rename.data.frame(...)
 Error in map(.x, .f, ...) : 
Caused by error in `dplyr::rename()`:
! Can't rename columns that don't exist.
x Column `preview_url` doesn't exist.

I'm not sure how to diagnose the issue. Similarly, "Built To Spill" works, but "Chumbawamba" does not.

t-davidson added a commit to t-davidson/spotifyr that referenced this issue Sep 20, 2024
This line raised an error for some artists, see charlie86#202
@t-davidson
Copy link
Contributor

I encountered the same problem. Perhaps the Spotify API has stopped returning the preview_url field. I found the part of the code where this field is used and commented it out in a fork of the repository, see t-davidson@296712e

I have tested it and it works without error (although obviously, this may be a problem if preview_url was a field you were interested in extracting). I made a pull request (#203), but it does not seem like this repository is being actively maintained. You could use devtools to re-install the package from my fork.

@nickreich
Copy link

Thanks @t-davidson ! I was running into the same issue and your patch seems to work. I use this package in an exercise for my data science class, and you saved me an 11th hour coding scramble by just being able to point students to your patch of the package.

@t-davidson
Copy link
Contributor

I’m glad to help, I was facing exactly the same scenario!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants