MENU

Fun & Interesting

How to access Spotify data using R (using the httr2 package)

Melissa Van Bussel (ggnot2) 1,454 lượt xem 10 months ago
Video Not Working? Fix It Now

In this video, we'll learn how to access Spotify data in R using the Spotify Web API. We'll walk through obtaining a client ID and client secret, and using these to generate a Spotify access token. Then, we use the httr2 package for API requests. We'll go through an example of retrieving information about playlist tracks, including song names, artist details, album art, and popularity metrics, and how to turn all of this information into a structured data frame. Additionally, we'll explore a more advanced API endpoint (the audio analysis endpoint) to extract detailed track information such as the tempo of the song during each section of the track.

This video is video #3 of a six-video series (there's only six, not seven, oops - I misspoke in the video intro) aimed at making complex dashboard projects accessible and reproducible.

Video 1 (Publishing Quarto Dashboards for FREE using GitHub Actions and GitHub Pages): https://youtu.be/5zYrgRylkH0
Video 2 (How to securely store passwords as environment variables using GitHub Actions): https://youtu.be/RNqsqcOYDp0
Video 3 (How to access Spotify data using R): https://youtu.be/MLs0f9vNk9c
Video 4 (Embedding media in Quarto projects using iframes): https://youtu.be/y7ZdBUtQxqg
Video 5 (Creating interactive Quarto dashboards with Observable JS, GitHub Actions, and GitHub Pages): https://youtu.be/1k1ExCgzXl0
Video 6 (Creating and styling the table): https://youtu.be/27Njh1i9-oM

Links:
Completed dashboard: https://melissavanbussel.github.io/spotify-dashboard/dashboard.html
Code repo for dashboard: https://github.com/melissavanbussel/spotify-dashboard

Want to support my channel or connect?

☕Buy me a coffee: https://ko-fi.com/melissavanbussel
💼 LinkedIn: https://www.linkedin.com/in/melissavanbussel/
🐦 Twitter: https://twitter.com/melvanbussel
🌐 Website: https://www.melissavanbussel.com/
💻 GitHub: https://github.com/melissavanbussel

*Please note: it’s helpful for me if you send me a message on LinkedIn when you add me letting me know you’re adding me because of YouTube, so that I can keep track of how I know each person in my network😊

00:00 Introduction
02:25 Generating a Spotify access token
08:58 Accessing Spotify playlists
15:13 Extracting audio analysis of Spotify songs

Comment