Skip to content

Simple script to return latest monthly listeners from any Spotify ID using the Soundcharts API.

License

Notifications You must be signed in to change notification settings

JeremLeOuf/GetMonthlyListeners_fromSpotifyIDs_SoundCharts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get Spotify Monthly Listeners from a list of Spotify IDs.

This is a simple script to return latest monthly listeners from any Spotify ID list using the Soundcharts API.

NOTE: THIS WILL ONLY WORK WITH SOUNDCHARTS SANDBOX CREDENTIALS, that are included in the code.

To use it on the PROD SOUNDCHARTS environement, you must obtain Soundcharts Production credentials and update the code accordingly.
To do that, please refer to the Soundcharts documentation.
    Feel free to reach out if you need some help!


Input:

  • Input required:
    • A CSV file with each Spotify IDs you want to fetch the recent monthly listeners from, one per line.
    • This CSV file containing Spotify IDs must be located in the input folder (for simplicity).

IMPORTANT NOTE:

  • With the SANDBOX Soundcharts credentials, you are limited to the two rows in \input\spotify_ids.csv, that are respectively 'Billie Eilish' and 'Tones & I'.
  • With the PRODUCTION Soundcharts credentials, you can add as many spotify_id's as you want
    • ⚠️ Be VERY careful as it will use credits from your paid Soundcharts API plan!

  • Format of the default .csv input file:

|spotify_id            |
|----------------------|
|6qqNVTkY8uBg9cP3Jd7DAH|
|2NjfBq1NflQcKSeiDooVjY|
This is the actual content of the default spotify_ids.csv file, located in the `input` folder that will be exported and used for the rest of the program.

HOWEVER, it could handle as many spotify_id's you desire AS LONG AS YOUR ARE USING PRODUCTION CREDENTIALS (not included in this public repo, for obvious privacy reasons).
With SANDBOX credentials, you'll be able only to use the two artists above (Billie Eilish and Tones & I, only artists included in the sandbox dataset.

Execution:

  • Run the main.py file.
  • It will prompt you with a window where you have to select the aforementioned spotify_id.csv file.
    It should direct you to the appropriate directory by default.
  • The program will first print how the file structure looks like. (informative)
  • It will then print how the resulting DataFrame will look like. (informative)
  • After 2 seconds, it will print it to a new .csv file named results-{YYYY-MM-DD}.csv (with today's date), located in the output folder, and show you a success message (if successful).
  • All done! 🎉

Output:

✅ Now, you should find the correctly named output file in the output folder.
📈 Enjoy!

The output should look like this:

image

Bottom line:

  • For any suggestions for improvements / optimizations, I'm very welcome to any advice, so feel free to commit!- I'm a fairly new Python developer, trying to constantly learn and improve. All suggestions are welcome!
  • You can reach out to me on my GitHub, through Discord or on my Twitter.
    Happy to connect to y'all! Cheers! 🤖

About

Simple script to return latest monthly listeners from any Spotify ID using the Soundcharts API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages