You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
d-fi is a streaming music downloader. This core module is designed to be used on future version of d-fi.
Installation
$ yarn add d-fi-core
Usage
Here's a simple example to download tracks.
importaxiosfrom'axios';importfsfrom'fs';import*asapifrom'd-fi-core';// Init api with arl from cookieawaitapi.initDeezerApi(arl_cookie);// Verify usertry{constuser=awaitapi.getUser();// Successfully logged inconsole.log('Logged in as '+user.BLOG_NAME);}catch(err){// Invalid arl cookie setconsole.error(err.message);}// GET Track Objectconsttrack=awaitapi.getTrackInfo(song_id);// Parse download URL for 128kbpsconsttrackData=awaitapi.getTrackDownloadUrl(track,1);// Download trackconst{data}=awaitaxios.get(trackdata.trackUrl,{responseType: 'arraybuffer'});// Decrypt track if neededconstoutFile=trackData.isEncrypted ? api.decryptDownload(data,track.SNG_ID) : data;// Add id3 metadataconsttrackWithMetadata=awaitapi.addTrackTags(outFile,track,500);// Save file to diskfs.writeFileSync(track.SNG_TITLE+'.mp3',trackWithMetadata);