Identifying Similarities in Audience Analytics / Demographics of Popular Spotify Artist: Bad Bunny
Introduction:
Spotify is one of the largest music streaming services in the world as hundreds of millions of users turn on their headphones to listen to the music that they love. Top artists on the platform generate millions of monthly listeners all from different parts of the world. One of the most streamed artists on the platform, Bad Bunny, incorporates both English and Spanish lyrics into his music giving millions of listeners the opportunity to enjoy his music. As Bad Bunny soars to the top of the US listening charts, it begs the question of whether or not his top songs differ based on listening demographic. Most of Bad Bunny’s music is sung in Spanish which makes sense why the country where Bad Bunny is most listened to globally is Mexico. In this post I will analyze if Bad Bunny’s top songs differ between listeners in the United States, and listeners in Mexico.
Data Collection and Analysis:
The data that could answer my question would be Bad Bunny’s top songs in the United States vs Mexico. This is relevant as it will allow me to view any differences in the listening demographics. In order to see the similarities or differences in Bad Bunny’s top songs, I need to access the Spotify API. I made use of API requests in order to pull and view Spotify’s stored artist data. The following is some code I wrote to request a token in order to gain access to the Spotify API:
In order to send requests to the Spotify API, I needed to provide a token which required client_id and client_secret (both environmental variables). Once I had the token, I was able to send requests to the Spotify API in order to pull data on Bad Bunny’s top 10 songs in both the United States and in Mexico. A code snippet is provided here:
This code allows me to pull the top songs from Bad Bunny in the United States. Note the “US” at the end of the string in the URL variable. This lets the API know I want to pull data from the United States charts. To pull from Mexico, I replace “US” with “MX”. The following is a comparison between the top songs in the United States vs Mexico:
Bad bunny’s top 10 songs did not differ between the United States and Mexico. This is telling as it shows the cultural influence that Mexico has in the United States, considering that the majority of Bad Bunny’s listeners are Mexican. Much of the mainstream music in Mexico has heavily influenced the US Spotify Charts as Bad Bunny is quickly becoming one of the most listened to artists in the states.
Hurdles and Conclusion:
One hurdle or potential security issue I encountered was in the client_id and security_id variables. These variables should not be able to be viewed by everyone as it is a potential security risk. With these codes, anyone could gain access to my Spotify project account. To solve this, I set them as environment variables that are defined in a separate file. This way I could reference the variables contents, without having it clearly defined in my code. I recommend others use the same approach.
This analysis is potentially limited as I only displayed the top 10 songs of the artist, if I had gotten a longer list there might have been differences. One aspect that is perhaps missing is the artist’s top albums. I imagine that the top listened to albums may differ between countries, especially considering some albums are more English dominated than Spanish.
Link to code in Github: https://github.com/dav1dalvaro/INST414/blob/main/Assigment1.py