Package: py-deezer
PyDeezerA package to search and download musics onDeezer.InstallationInstall from releasepipinstallpy-deezerInstall from repositorygitclonehttps://github.com/Chr1st-oo/pydeezer.gitcdpydeezer
pipinstall.Usage as a CLIUsage:pydeezer[OPTIONS]COMMAND[ARGS]...PyDeezerCLI

Options:--helpShowthismessageandexit.

Commands:downloadDownloadtracksCommandsUsage:pydeezerdownload[OPTIONS]Downloadtracks

Options:-a,--arlTEXTUsedtobeabletologintoDeezer.Checkthedocsonhowtogetone.--media-type[Track|Album|Playlist|Artist]Setsthemediatypeandhowitsearchestheapi.-d,--download-dirDIRECTORYSetsthedirectoryonwherethetracksaretobesaved.-q,--quality[MP3_128|MP3_256|MP3_320|FLAC]Setsthequalityofthetracks.iftheprovidedqualityisnotsupported,thedefaultqualityofthetrackwillbeused.--helpShowthismessageandexit.Usage as a packageLogging InfrompydeezerimportDeezerarl="edit_this"deezer=Deezer(arl=arl)user_info=deezer.user# or# deezer = Deezer()# user_info = deezer.login_via_arl(arl)You can get the yourarlby manually logging intoDeezerusing your browser and check thecookiesand look for the value ofarl.Searching# Some login code here# Search trackstrack_search_results=deezer.search_tracks("IM DOPE")# Search albumsalbum_search_results=deezer.search_albums("DAMN",limit=10)# Search artistsartist_search_results=deezer.search_artists("J. Cole",limit=5)# Search playlistsplaylist_search_results=deezer.search_playlists("top",index=2)Getting Information and Downloading# Some login code here# Some download stuffsfrompydeezerimportDownloaderfrompydeezer.constantsimporttrack_formatsdownload_dir="C:\\Users\\User\\Music"track_id="547653622"track=deezer.get_track(track_id)# track is now a dict with a key of info, download, tags, and get_tag# info and tags are dicttrack_info=track["info"]tags_separated_by_comma=track["tags"]# download and get_tag are partial functionstrack["download"](download_dir,quality=track_formats.MP3_320)# this will download the file, default file name is Filename.[mp3 or flac]tags_separated_by_semicolon=track["get_tag"](separator="; ")# this will return a dictionary similar to track["tags"] but this will override the default separatorartist_id="53859305"artist=deezer.get_artist(artist_id)album_id="39949511"album=deezer.get_album(album_id)# returns a dict containing data about the albumplaylist_id="1370794195"playlist=deezer.get_playlist(playlist_id)# returns a dict containing data about the playlist# Multithreaded Downloaderlist_of_id=["572537082","921278352","927432162","547653622"]downloader=Downloader(deezer,list_of_ids,download_dir,quality=track_formats.MP3_320,concurrent_downloads=2)downloader.start()Custom ProgressHandlerThis example uses the amazingtqdmpackage.CodefrompydeezerimportDeezerfrompydeezer.ProgressHandlerimportBaseProgressHandlerfromtqdmimporttqdm# Extend BaseProgressHandler and override its initialize, update and close methods accordinglyclassMyProgressHandler(BaseProgressHandler):def__init__(self):passdefinitialize(self,*args):super().initialize(*args)self.pbar=tqdm(self.iterable,total=self.total_size,unit="B",unit_scale=True,unit_divisor=1024,leave=False,desc=self.track_title)defupdate(self):self.pbar.update(self.current_chunk_size)defclose(self):self.pbar.close()# When starting a download, pass your ProgressHandler instance in progress_handler keyword argument.print("DefaultProgressHandler")track["download"](download_dir,quality=track_formats.FLAC)print()my_progress_handler=MyProgressHandler()print("CustomProgressHandler")track["download"](download_dir,quality=track_formats.FLAC,progress_handler=my_progress_handler)OutputTODOMore CLI features, save used Arls for convenience.Multithreaded downloader (1 song / 1 thread)Binary fileGUIDisclaimerI will and should not be held responsible for the usage of this package.Don't use this package illegaly and against Deezer'sTerms Of Use.This is licensed underGNU GPL v3.