-
Notifications
You must be signed in to change notification settings - Fork 64
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_track_audio_features() causes an HTTP error using a for-loop ( >100 tracks) | Interval loop causes an error, too #130
Comments
Ok, just for the record: I could solve those issues with a well-performing function that takes a sample of 100 IDs (without replacement) from an ID vector within a while-loop and adds them to a tibble. Then, the sampled IDs are dropped from the vector from which those 100 IDs were taken so that the not yet sampled IDs can be sampled from the vector. If less than 100 IDs are remaining, those remaining IDs will be taken. In the end, the function returns a tibble with all audio features and track IDs. |
Can you please replicate what exactly causes the error? I.e. place a code here that runs into the actual HTTP error? |
First of all, sorry for the delayed answer. Here I am attaching my solution and the not working attempts with actual IDs from a current study. Once the respective Client ID and the Client Secret are entered, the following script should run on its own and should yield the errors in question. With this, I hope to comply with your request.
All in all, I could work around this issue quite well with this employed |
Hi,
When I am trying to load audio features for >100 tracks (i.e., 3115) using for-loops, I am getting the following errors:
For-loop 1)
As reference: https://stackoverflow.com/questions/36104466/looping-through-a-list-in-chunks
Yields:
Alternatively, I also tried
for(i in seq(1,length(temp),chunk))
instead offor(i in ceiling(temp/chunk))
and alsomin(length(temp),(i*chunk))
.The most intuitive loop causes an HTTP error:
For-loop 2)
Yields:
So my question is this: What am I doing wrong and how can I fix this issue?
Thanks for any helpful advice!
The text was updated successfully, but these errors were encountered: