Example of working with Deezer API in Python 3.
Download your listening history with this simple Flask App!
Used libraries:
Based on Requests-OAuthlib GitHub OAuth 2 Tutorial
- Create a new Deezer Application at the Deezer for developers
Important: When creating your app, set field Redirect URL after authentication to https://127.0.0.1:5000/callback
Other fields can be set to whatever you want :)
- Fill in missing fields in "config.json" file
-
app_id:
"Application ID" in application settings(Example: 289071)
-
client_secret:
"Secret Key" in application settings(Example: 23a1ca17cf5ea13a03e1f4155320aec6)
-
user_id:
"Deezer User ID" from your profile page URL(Example: if your profile page URL is "https://www.deezer.com/en/profile/102643295", your User ID is 102643295)
-
Install dependencies:
pip install -r requirements.txt
-
Launch your application
python3 app.py
-
Go to https://127.0.0.1:5000/ in your web-browser
You will be asked to give permissions to your newly created application.
Press "Accept".
After that you should see the line:
History has been loaded! Check out the file in the project directory :)
If this line appears, congratulations!
You have successfully downloaded all of your available Deezer listening history!
- Open "deezer_history<current_date>.json" file in your project directory.
It's structure is basically:
{
"data": [
{track_1_dict},
{track_2_dict},
...
{track_n_dict}
]
}
For the format of track information, see Deezer API Explorer.
Check Deezer API Page for more information on Deezer API.