sanzy-spotifydl
Version:
Simple Scraper Spotify Track/Album/Playlist Downloader with Metadata
1 lines • 12.7 kB
JavaScript
const _0x1b3684=_0x3d5c;(function(_0x41fbe9,_0x3649df){const _0x59544e=_0x3d5c,_0x1957b0=_0x41fbe9();while(!![]){try{const _0x415628=-parseInt(_0x59544e(0x11e))/0x1*(-parseInt(_0x59544e(0x116))/0x2)+-parseInt(_0x59544e(0x10a))/0x3+parseInt(_0x59544e(0x11d))/0x4*(-parseInt(_0x59544e(0x105))/0x5)+-parseInt(_0x59544e(0x12e))/0x6*(parseInt(_0x59544e(0xfe))/0x7)+parseInt(_0x59544e(0x126))/0x8+parseInt(_0x59544e(0x10c))/0x9+parseInt(_0x59544e(0xff))/0xa;if(_0x415628===_0x3649df)break;else _0x1957b0['push'](_0x1957b0['shift']());}catch(_0x2e619){_0x1957b0['push'](_0x1957b0['shift']());}}}(_0x249c,0x6f838));const _0xd5678=_0x1385;(function(_0x7117ac,_0x724d31){const _0x1a8c46=_0x3d5c,_0xfc74cd=_0x1385,_0x13b7a2=_0x7117ac();while(!![]){try{const _0x5c4d2b=-parseInt(_0xfc74cd(0x6f))/0x1*(parseInt(_0xfc74cd(0xb9))/0x2)+parseInt(_0xfc74cd(0x71))/0x3*(parseInt(_0xfc74cd(0xae))/0x4)+-parseInt(_0xfc74cd(0xb4))/0x5*(parseInt(_0xfc74cd(0x98))/0x6)+-parseInt(_0xfc74cd(0xb1))/0x7+parseInt(_0xfc74cd(0x9b))/0x8+-parseInt(_0xfc74cd(0xa5))/0x9+parseInt(_0xfc74cd(0x79))/0xa*(parseInt(_0xfc74cd(0x96))/0xb);if(_0x5c4d2b===_0x724d31)break;else _0x13b7a2[_0x1a8c46(0x10e)](_0x13b7a2[_0x1a8c46(0xf7)]());}catch(_0x390b98){_0x13b7a2[_0x1a8c46(0x10e)](_0x13b7a2['shift']());}}}(_0x12b7,0x23777));const {isUrl,tags2,tags,convertMs}=require(_0xd5678(0xaa)),nodeID3=require(_0xd5678(0x8b)),axios=require(_0xd5678(0x7e)),cheerio=require(_0xd5678(0x9e)),fetch=require(_0x1b3684(0x133)),spot=require(_0xd5678(0xb5)),spotify=new spot({'consumer':{'key':_0xd5678(0xa8),'secret':_0xd5678(0x9a)}}),options={'headers':{'Origin':'https://spotifydown.com','Referer':_0xd5678(0xa0)}};async function getOriginalUrl(_0xb164ff){const _0x1be084=_0xd5678,_0x442625=await fetch(_0xb164ff);return _0x442625[_0x1be084(0xad)];}function _0x3d5c(_0x3df424,_0x3cfe9e){const _0x249cf4=_0x249c();return _0x3d5c=function(_0x3d5c03,_0x16d0d5){_0x3d5c03=_0x3d5c03-0xf0;let _0x317a44=_0x249cf4[_0x3d5c03];return _0x317a44;},_0x3d5c(_0x3df424,_0x3cfe9e);}function _0x249c(){const _0xa2c992=['url','Input\x20Url','15ONUgns','5978550lYIMLl','release_date','6bbkfiz','buffer','getTrack','axios','releaseDate','node-fetch','popularity','join','Search\x20function\x20not\x20support\x20for\x20url','tracks','78e2ece45fa446c98517d2cbb3271486','11mIsTfI','Invalid\x20album/playlist\x20url','track','split','spotify-finder','external_urls','shift','total_tracks','length','name','open.spotify.com','album/','includes','1336706TSRTuJ','11790430tfZEZi','message','Downloading\x20audio...','2021656LoudZa','type','items','5QiDFpI','https://api.spotifydown.com/metadata/','get','https://api.spotifydown.com/metadata/track/','spotify','1589541aWLTpv','https://api.spotifydown.com/trackList/','6080760CHQUTD','Please\x20wait\x20for\x20a\x20moment,\x20this\x20process\x20will\x20take\x20for\x20a\x20couple\x20minutes','push','status','success','title','log','cover','174567WrQNfb','4zQkCig','4342aBgqhD','1857552EYzwQn','1622iwAGTB','album','link','Please\x20input\x20Url','then','3104888MtANCB','3JabhcV','audioBuffer','artists','track/','https://spotifydown.com/','playlist/','metadata','explicit','740728GQFNFu','Unknown\x20error\x20occurred!\x0a\x0a','trackList'];_0x249c=function(){return _0xa2c992;};return _0x249c();}function _0x1385(_0x33531f,_0x15e851){const _0xf3748f=_0x12b7();return _0x1385=function(_0x2243ce,_0x8aab49){_0x2243ce=_0x2243ce-0x6e;let _0x29f26b=_0xf3748f[_0x2243ce];return _0x29f26b;},_0x1385(_0x33531f,_0x15e851);}async function downloads(_0x194c15){const _0x1366b3=_0x1b3684,_0x426578=_0xd5678;if(!isUrl(_0x194c15))throw new Error(_0x426578(0x99));if(_0x194c15[_0x426578(0xa9)](_0x426578(0x92))){const _0x11f6ca=await getOriginalUrl(_0x194c15),_0x4b13b3=await axios[_0x426578(0xac)](_0x426578(0x86)+_0x11f6ca[_0x1366b3(0xf4)](_0x1366b3(0x121))[0x1][_0x426578(0x82)]('?')[0x0],options),{data:_0x323fbe}=await axios[_0x1366b3(0x107)]('https://api.spotifydown.com/download/'+_0x4b13b3[_0x426578(0x93)]['id'],options),_0x30fcda=await fetch(_0x323fbe['link'])['then'](_0x4c400f=>_0x4c400f[_0x426578(0x77)]()),_0x311709=await fetch(_0x323fbe['metadata'][_0x426578(0xa4)])[_0x1366b3(0x11c)](_0x1e343d=>_0x1e343d[_0x426578(0x77)]()),_0x258e15=tags2(_0x323fbe[_0x426578(0x8a)][_0x426578(0xa6)],_0x323fbe[_0x426578(0x8a)][_0x426578(0xb7)],_0x323fbe[_0x426578(0x8a)][_0x1366b3(0x132)],_0x323fbe[_0x1366b3(0x124)][_0x426578(0xb8)],_0x311709),_0x2e4b64=await nodeID3['write'](_0x258e15,_0x30fcda),_0x392cb7={'success':_0x323fbe[_0x426578(0xb2)],'metadata':_0x323fbe[_0x426578(0x8a)],'audioBuffer':_0x2e4b64};return _0x392cb7;}else{if(_0x194c15[_0x426578(0xa9)](_0x1366b3(0xfb))){const {data:_0x161350}=await axios[_0x1366b3(0x107)](_0x426578(0x87)+_0x194c15[_0x426578(0x82)](_0x426578(0xaf))[0x1][_0x426578(0x82)]('?')[0x0],options),_0x26e2ae=await fetch(_0x161350[_0x426578(0x73)])[_0x426578(0x7a)](_0x3978f5=>_0x3978f5[_0x426578(0x77)]()),_0x50413f=await fetch(_0x161350[_0x426578(0x8a)][_0x1366b3(0x113)])[_0x426578(0x7a)](_0x3533d6=>_0x3533d6[_0x426578(0x77)]()),_0x556061=tags2(_0x161350[_0x426578(0x8a)][_0x1366b3(0x111)],_0x161350[_0x426578(0x8a)][_0x426578(0xb7)],_0x161350[_0x1366b3(0x124)][_0x426578(0x8e)],_0x161350[_0x426578(0x8a)][_0x426578(0xb8)],_0x50413f),_0x46384d=await nodeID3[_0x426578(0x97)](_0x556061,_0x26e2ae),_0x2e35a5={'success':_0x161350[_0x426578(0xb2)],'metadata':_0x161350['metadata'],'audioBuffer':_0x46384d};return _0x2e35a5;}else{const _0x3c8e36={'status':![],'message':_0x426578(0x7f)};return console[_0x1366b3(0x112)](_0x3c8e36),_0x3c8e36;}}}async function search(_0x52dd53,_0x33ab71){const _0x10df5f=_0xd5678;if(isUrl(_0x52dd53))throw new Error(_0x10df5f(0x89));const _0x1d8ec0=_0x33ab71?_0x33ab71:0x1,_0x1ab724=await spotify[_0x10df5f(0x9c)]({'q':_0x52dd53,'type':_0x10df5f(0xa1),'limit':_0x1d8ec0});return _0x1ab724[_0x10df5f(0xa7)];}async function downloadAlbum(_0x1fd565){const _0x4044e8=_0x1b3684,_0x2e90f6=_0xd5678;let _0x1c58e5={'type':null,'metadata':{},'trackList':[]};if(!isUrl(_0x1fd565))throw new Error(_0x2e90f6(0x90));try{if(_0x1fd565[_0x2e90f6(0xa9)](_0x2e90f6(0x92))){const _0x28af31=await getOriginalUrl(_0x1fd565);if(!_0x28af31[_0x2e90f6(0xa9)](_0x2e90f6(0xb6))&&!_0x28af31['includes'](_0x2e90f6(0x9f)))throw new Error(_0x2e90f6(0x91));if(_0x28af31[_0x4044e8(0xfd)](_0x2e90f6(0xb6)))var _0xd1d32f=_0x4044e8(0xfc);else var _0xd1d32f=_0x2e90f6(0x9f);const _0x25cc0a=await axios['get']('https://api.spotifydown.com/metadata/'+_0xd1d32f+_0x28af31[_0x2e90f6(0x82)](_0xd1d32f)[0x1][_0x2e90f6(0x82)]('?')[0x0],options);_0x1c58e5[_0x2e90f6(0x83)]=_0xd1d32f[_0x4044e8(0xf4)]('/')[0x0],_0x1c58e5[_0x2e90f6(0x8a)]=_0x25cc0a[_0x2e90f6(0x93)];const {data:_0x3d6805}=await axios[_0x2e90f6(0xac)](_0x2e90f6(0x78)+_0xd1d32f+_0x28af31[_0x2e90f6(0x82)](_0xd1d32f)[0x1][_0x2e90f6(0x82)]('?')[0x0],options);console[_0x2e90f6(0x74)](_0x2e90f6(0x6e)),console[_0x4044e8(0x112)](_0x2e90f6(0x95));for(let _0x445403=0x0;_0x445403<_0x3d6805[_0x2e90f6(0x7b)][_0x4044e8(0xf9)];_0x445403++){const _0x2c799a=await downloads(_0x2e90f6(0xbb)+_0x3d6805[_0x2e90f6(0x7b)][_0x445403]['id']);_0x1c58e5[_0x2e90f6(0x7b)][_0x2e90f6(0x72)](_0x2c799a);}return _0x1c58e5;}else{if(_0x1fd565[_0x2e90f6(0xa9)](_0x2e90f6(0x81))){if(!_0x1fd565[_0x2e90f6(0xa9)](_0x2e90f6(0xb6))&&!_0x1fd565[_0x4044e8(0xfd)](_0x2e90f6(0x9f)))throw new Error(_0x4044e8(0xf2));if(_0x1fd565[_0x2e90f6(0xa9)](_0x2e90f6(0xb6)))var _0xd1d32f=_0x2e90f6(0xb6);else var _0xd1d32f=_0x2e90f6(0x9f);const _0x3cd105=await axios[_0x2e90f6(0xac)](_0x4044e8(0x106)+_0xd1d32f+_0x1fd565[_0x2e90f6(0x82)](_0xd1d32f)[0x1][_0x2e90f6(0x82)]('?')[0x0],options);_0x1c58e5[_0x4044e8(0x103)]=_0xd1d32f[_0x4044e8(0xf4)]('/')[0x0],_0x1c58e5[_0x2e90f6(0x8a)]=_0x3cd105[_0x2e90f6(0x93)];const {data:_0x3116c0}=await axios[_0x2e90f6(0xac)](_0x2e90f6(0x78)+_0xd1d32f+_0x1fd565[_0x2e90f6(0x82)](_0xd1d32f)[0x1][_0x2e90f6(0x82)]('?')[0x0],options);console[_0x2e90f6(0x74)](_0x2e90f6(0x6e)),console['log'](_0x2e90f6(0x95));for(let _0x41b735=0x0;_0x41b735<_0x3116c0[_0x2e90f6(0x7b)][_0x4044e8(0xf9)];_0x41b735++){const _0x268d8f=await downloads(_0x2e90f6(0xbb)+_0x3116c0[_0x2e90f6(0x7b)][_0x41b735]['id']);_0x1c58e5[_0x4044e8(0x128)][_0x2e90f6(0x72)](_0x268d8f);}return _0x1c58e5;}else throw new Error(_0x2e90f6(0xa3));}}catch(_0x2585f2){return console[_0x4044e8(0x112)](_0x2585f2),String(_0x2585f2);}}async function downloadTrack(_0x2998fe){const _0x28b665=_0x1b3684,_0x558c4c=_0xd5678;let _0x409b32={};if(isUrl(_0x2998fe))try{if(_0x2998fe[_0x28b665(0xfd)](_0x558c4c(0x92))){const _0x10949d=await getOriginalUrl(_0x2998fe);if(!_0x10949d[_0x28b665(0xfd)](_0x558c4c(0xaf))){;return _0x409b32[_0x558c4c(0x80)]=![],_0x409b32[_0x558c4c(0x84)]='Download\x20track\x20not\x20support\x20for\x20Album/Playlist',console[_0x558c4c(0x74)](_0x409b32),_0x409b32;}var _0x5f3fc0=await spotify[_0x558c4c(0x7c)](_0x10949d[_0x558c4c(0x82)](_0x558c4c(0xaf))[0x1][_0x558c4c(0x82)]('?')[0x0]);}else var _0x5f3fc0=await spotify[_0x558c4c(0x7c)](_0x2998fe[_0x558c4c(0x82)](_0x558c4c(0xaf))[0x1]['split']('?')[0x0]);const _0x497743=await downloads(_0x2998fe);return _0x409b32={'status':!![],'title':_0x5f3fc0['name'],'artists':_0x5f3fc0[_0x558c4c(0xb7)]['map'](_0xd2e216=>_0xd2e216[_0x558c4c(0x8d)])[_0x28b665(0x135)](',\x20'),'duration':convertMs(_0x5f3fc0['duration_ms']),'explicit':_0x5f3fc0[_0x28b665(0x125)],'popularity':_0x5f3fc0[_0x28b665(0x134)],'url':_0x5f3fc0[_0x558c4c(0xa2)][_0x558c4c(0xb3)],'album':{'name':_0x5f3fc0[_0x558c4c(0xb8)][_0x558c4c(0x8d)],'type':_0x5f3fc0[_0x558c4c(0xb8)][_0x558c4c(0x8c)],'tracks':_0x5f3fc0[_0x558c4c(0xb8)][_0x558c4c(0x9d)],'releasedDate':_0x5f3fc0[_0x558c4c(0xb8)][_0x558c4c(0x7d)]},'imageUrl':_0x5f3fc0[_0x28b665(0x119)][_0x558c4c(0x94)][0x0][_0x28b665(0x129)],'audioBuffer':_0x497743[_0x558c4c(0x75)]},_0x409b32;}catch(_0x436758){return _0x409b32={'status':![],'message':_0x558c4c(0xba)+String(_0x436758)},console[_0x558c4c(0x74)](_0x436758),_0x409b32;}else try{const _0x51ed9c=await search(_0x2998fe,0x1),_0x3121af=await downloads(_0x51ed9c[_0x558c4c(0x8f)][0x0][_0x28b665(0xf6)][_0x28b665(0x109)]);return _0x409b32={'status':!![],'title':_0x51ed9c[_0x558c4c(0x8f)][0x0][_0x558c4c(0x8d)],'artists':_0x51ed9c[_0x558c4c(0x8f)][0x0][_0x558c4c(0xb7)][_0x558c4c(0x85)](_0x398efe=>_0x398efe[_0x558c4c(0x8d)])[_0x558c4c(0x76)](',\x20'),'duration':convertMs(_0x51ed9c[_0x558c4c(0x8f)][0x0][_0x558c4c(0xab)]),'explicit':_0x51ed9c[_0x558c4c(0x8f)][0x0][_0x558c4c(0x70)],'popularity':_0x51ed9c[_0x558c4c(0x8f)][0x0][_0x558c4c(0xb0)],'url':_0x51ed9c[_0x28b665(0x104)][0x0][_0x558c4c(0xa2)][_0x558c4c(0xb3)],'album':{'name':_0x51ed9c[_0x558c4c(0x8f)][0x0][_0x558c4c(0xb8)][_0x558c4c(0x8d)],'type':_0x51ed9c[_0x558c4c(0x8f)][0x0][_0x558c4c(0xb8)][_0x558c4c(0x8c)],'tracks':_0x51ed9c[_0x558c4c(0x8f)][0x0][_0x558c4c(0xb8)][_0x558c4c(0x9d)],'releasedDate':_0x51ed9c[_0x558c4c(0x8f)][0x0][_0x558c4c(0xb8)][_0x558c4c(0x7d)]},'imageUrl':_0x3121af[_0x558c4c(0x8a)][_0x558c4c(0xa4)],'audioBuffer':_0x3121af[_0x558c4c(0x75)]},_0x409b32;}catch(_0x4360ef){return _0x409b32={'status':![],'message':_0x558c4c(0xba)+String(_0x4360ef)},console[_0x558c4c(0x74)](_0x409b32),_0x409b32;}}function _0x12b7(){const _0x578205=_0x1b3684,_0x1aba9d=['9e1c5e192a8141c59b7e91f2848e6a9c','includes','../function/index.js','duration_ms',_0x578205(0x107),_0x578205(0x129),_0x578205(0x115),_0x578205(0x121),'popularity',_0x578205(0x102),_0x578205(0x110),_0x578205(0x109),_0x578205(0x12b),_0x578205(0xf5),_0x578205(0xfc),_0x578205(0x120),_0x578205(0x119),_0x578205(0x118),_0x578205(0x127),'https://open.spotify.com/track/',_0x578205(0x101),'226FetXXQ','explicit',_0x578205(0x114),_0x578205(0x10e),_0x578205(0x11a),_0x578205(0x112),_0x578205(0x11f),_0x578205(0x135),_0x578205(0x12f),_0x578205(0x10b),_0x578205(0x12c),_0x578205(0x11c),_0x578205(0x128),_0x578205(0x130),_0x578205(0x12d),_0x578205(0x131),'Please\x20input\x20valid\x20spotify\x20url',_0x578205(0x10f),'open.spotify.com','split',_0x578205(0x103),_0x578205(0x100),'map',_0x578205(0x108),'https://api.spotifydown.com/download/','exports',_0x578205(0x136),_0x578205(0x124),'node-id3','album_type',_0x578205(0xfa),_0x578205(0x132),_0x578205(0x104),_0x578205(0x12a),_0x578205(0xf2),'spotify.link','data','images',_0x578205(0x10d),_0x578205(0xf1),'write','525846exksnd',_0x578205(0x11b),_0x578205(0xf0),_0x578205(0x117),'search',_0x578205(0xf8),'cheerio',_0x578205(0x123),_0x578205(0x122),_0x578205(0xf3),_0x578205(0xf6),'Invalid\x20Url!',_0x578205(0x113),'71550bfbyUi',_0x578205(0x111),_0x578205(0x137)];return _0x12b7=function(){return _0x1aba9d;},_0x12b7();}module[_0xd5678(0x88)]={'downloadAlbum':downloadAlbum,'getOriginalUrl':getOriginalUrl,'search':search,'downloadTrack':downloadTrack,'downloads':downloads};