Grabber your spotify playlists and recently played songs.
Project description
Spotigrabber - Exporting your Spotify tracklists
This Python package allows you to export your Spotify playlists and recently played tracks as an Excel file. It uses the Spotipy library to interact with the Spotify Web API. Due limitations of the spotify API, at maximum the last 50 played songs can be exported. Also, only songs that were listended all to the end are in the record. []
Installation
Setting up Spotify API credentials
To access the Spotify API, you need to have API credentials in the form of a client_id
, client_secret
, and a redirect_uri
. Here's how you can get your credentials:
- Go to the Spotify Developer Dashboard: https://developer.spotify.com/dashboard/
- Log in with your Spotify account or create a new one if you don't have one yet.
- Click on "Create an App" and fill in the required information.
- After creating the app, you will see your
client_id
andclient_secret
in the app's Dashboard. - Set the
redirect_uri
for your app by clicking "Edit Settings" and adding a redirect URI, such as "http://localhost:9000".
Now that you have your credentials, you should add them to your systems environment variables. To do so, open a windows cmd and enter the commands:
setx SPOTIFY_CLIENT_ID "your-client-id"
setx SPOTIFY_CLIENT_SECRET "your-client-secret"
setx SPOTIFY_USERNAME "your-spotify-username"
The ID and secret are now stored on your computer locally and will be found by the python code.
Installation of the python package
The package with all dependencies can be installed with the following command: You can install them with the following command:
pip install spotigrabber
Package usage
The package contains several functions to interact with your Spotify playlists and recently played tracks. You can use it as a standalone script or import the functions in your own Python project.
Main function
The main
function is the entry point of the script. It takes two optional arguments:
playlists_file
: The filename for the Excel file that will contain all your playlists (default: 'playlists').recently_file
: The filename for the Excel file that will contain your 50 most recently played songs (default: 'recently_played').
To run the script you have various options
- In a shell, navigate to the installed package (in your pythons install directory under site-packages) and use the following command:
python spotigrabber.py --playlistsfile my_playlists --recentlyfile my_recently_played
- In a shell, start your python
python
then import the installed package
import spotigrabber
and finally execute the main function
spotigrabber.main(playlists_file='my_playlists',recently_file='my_recently_played')
- From another python script. Create a new python script and add the two lines.
import spotigrabber
spotigrabber.main()
In any case, the current date will be added in front of your filename, such that when you export on a later date the files are not overwritten.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for spotigrabber-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1c865ab167aec41e09bb91aa4e3302131d746780fe31038fb76395133093f6d |
|
MD5 | da4e13037b4b02909747f50afbac069b |
|
BLAKE2b-256 | e3687834cf730b7b67425f03e44496ba28eb98251fd6175f46a87815b1327412 |