Skip to content

🎵 Library for working with Deezer API for creating a playlist by your preferences in Deezer

License

Notifications You must be signed in to change notification settings

ElinaValieva/deezer-playlist-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deezer-playlist-generator

Python package Upload Python Package Version Python

Library for working with Deezer API for creating a playlist by your preferences in Deezer

 

Installation 🔨

The package is published on PyPI and can be installed by running:

pip install deezer-playlist-generator

 

Usage 🎵

Easily query the Deezer API from you Python code. The data returned by the Deezer API is mapped to python resources:

>>> client = DeezerApi()
>>> client.get_artist(27).name
> 'Daft Punk'
>>> client.get_track(3135556).title
'Harder, Better, Faster, Stronger'
>>> client.get_album(302127).title
> 'Discovery'
>>> client.client.get_playlist(908622995).title
> 'Bain moussant'

Create your playlist with recommended tracks in Deezer:

>>> client = DeezerApi(app_id=<APP_ID>, secret=<SECRET>, redirect_url=<REDIRECTED_URL>, access=Access.MANAGE)
>>> tracks = client.create_recommendation_playlist(title='My Deezer Recommendation', count_tracks=10)

> Processing user playlist: 100%|██████████| 10/10 [00:03<00:00,  3.14it/s]
> Generating playlist: 100%|██████████| 10/10 [00:03<00:00,  3.31it/s]

 

Deezer Client 🚩

Supported permissions

Access.BASIC = basic_access
Access.MANAGE = manage_library
Access.DELETE = delete_library

Basic Client - client with basic_access, which supports access users basic information

client = DeezerApi()

Client with a token - the client allows for request an access token which is necessary to take action requiring the permissions you asked.

client = DeezerApi(token=<TOKEN>, expired=3600, access=Access.MANAGE)

Client with code auth - client with next token generation

client = DeezerApi(app_id=<APP_ID>, secret=<SECRET>, code=<CODE>, access=Access.MANAGE)

Client - client with all parameters, without a manual work for code and token generation

client = DeezerApi(app_id=<APP_ID>, secret=<SECRET>, redirect_url=<REDIRECTED_URL>, access=Access.DELETE)

 

Player ▶️

For reproducing a playlist by your preferences in Deezer:

from deezer_api import DeezerApi, Access, DeezerPlayer

client = DeezerApi(app_id=<APP_ID>, secret=<SECRET>, redirect_url=<REDIRECTED_URL>, access=Access.MANAGE)  
tracks = cp.generate_tracks()  
DeezerPlayer(tracks).start()