ali_api.js 32 KB

1
  1. const _0x475d0a=_0x1960;(function(_0x58bdb9,_0xcc9f09){const _0x54b68f=_0x1960,_0x24ba8c=_0x58bdb9();while(!![]){try{const _0x4f195b=parseInt(_0x54b68f(0xdd))/0x1+-parseInt(_0x54b68f(0x14d))/0x2+-parseInt(_0x54b68f(0x140))/0x3+parseInt(_0x54b68f(0x153))/0x4*(parseInt(_0x54b68f(0x115))/0x5)+-parseInt(_0x54b68f(0xf2))/0x6*(-parseInt(_0x54b68f(0x10d))/0x7)+parseInt(_0x54b68f(0x17f))/0x8+-parseInt(_0x54b68f(0x186))/0x9*(parseInt(_0x54b68f(0x152))/0xa);if(_0x4f195b===_0xcc9f09)break;else _0x24ba8c['push'](_0x24ba8c['shift']());}catch(_0x3fb5b5){_0x24ba8c['push'](_0x24ba8c['shift']());}}}(_0x2ae1,0x95c58));function _0x1960(_0x3b3566,_0x2e9adf){const _0x4fdc09=_0x2ae1();return _0x1960=function(_0x3a65fa,_0x389bb7){_0x3a65fa=_0x3a65fa-0xcb;let _0x369b0a=_0x4fdc09[_0x3a65fa];return _0x369b0a;},_0x1960(_0x3b3566,_0x2e9adf);}const _0x389bb7=(function(){let _0x1a7634=!![];return function(_0x5b6f22,_0x4aa7a8){const _0x30095d=_0x1a7634?function(){const _0x56cf0a=_0x1960;if(_0x4aa7a8){const _0x28af2f=_0x4aa7a8[_0x56cf0a(0xd4)](_0x5b6f22,arguments);return _0x4aa7a8=null,_0x28af2f;}}:function(){};return _0x1a7634=![],_0x30095d;};}()),_0x3a65fa=_0x389bb7(this,function(){const _0x43683a=_0x1960,_0x1b43ef=function(){const _0x112fa4=_0x1960;let _0x285433;try{_0x285433=Function(_0x112fa4(0x16e)+'{}.constructor(\x22return\x20this\x22)(\x20)'+');')();}catch(_0x5b0321){_0x285433=window;}return _0x285433;},_0x26fa0b=_0x1b43ef(),_0x1de15d=_0x26fa0b[_0x43683a(0xde)]=_0x26fa0b[_0x43683a(0xde)]||{},_0x58df9d=[_0x43683a(0x127),'warn',_0x43683a(0xd3),_0x43683a(0x178),_0x43683a(0x158),'table',_0x43683a(0x14c)];for(let _0x460471=0x0;_0x460471<_0x58df9d[_0x43683a(0x13c)];_0x460471++){const _0x21102a=_0x389bb7[_0x43683a(0x13d)][_0x43683a(0x12b)][_0x43683a(0xf5)](_0x389bb7),_0x3ab8f5=_0x58df9d[_0x460471],_0x1c5cad=_0x1de15d[_0x3ab8f5]||_0x21102a;_0x21102a[_0x43683a(0x160)]=_0x389bb7[_0x43683a(0xf5)](_0x389bb7),_0x21102a[_0x43683a(0x172)]=_0x1c5cad[_0x43683a(0x172)][_0x43683a(0xf5)](_0x1c5cad),_0x1de15d[_0x3ab8f5]=_0x21102a;}});_0x3a65fa();import{_,jinja2}from'./cat.js';import*as _0x5f2ae7 from'./utils.js';class User{constructor(){const _0x10e3ff=_0x1960;this[_0x10e3ff(0x16a)]='',this[_0x10e3ff(0x100)]='',this['tokenType']='',this[_0x10e3ff(0x131)]='',this[_0x10e3ff(0xee)]='';}static['objectFrom'](_0x168463){const _0x59ea84=_0x1960;if(_[_0x59ea84(0x187)](_0x168463))return new User();let _0x69ec9c=JSON['parse'](_0x168463),_0x4764ce=new User();return _0x4764ce[_0x59ea84(0x16a)]=_0x69ec9c['default_drive_id'],_0x4764ce['userId']=_0x69ec9c['user_id'],_0x4764ce['tokenType']=_0x69ec9c['token_type'],_0x4764ce[_0x59ea84(0x131)]=_0x69ec9c[_0x59ea84(0xfd)],_0x4764ce[_0x59ea84(0xee)]=_0x69ec9c['refresh_token'],_0x4764ce;}[_0x475d0a(0x180)](){const _0x3fecce=_0x475d0a;return _[_0x3fecce(0x187)](this[_0x3fecce(0x16a)])?'':this[_0x3fecce(0x16a)];}['getUserId'](){const _0x507a53=_0x475d0a;return _[_0x507a53(0x187)](this[_0x507a53(0x100)])?'':this[_0x507a53(0x100)];}[_0x475d0a(0xf7)](){const _0x363170=_0x475d0a;return _[_0x363170(0x187)](this[_0x363170(0x15b)])?'':this[_0x363170(0x15b)];}[_0x475d0a(0xd0)](){const _0x460056=_0x475d0a;return _[_0x460056(0x187)](this['accessToken'])?'':this[_0x460056(0x131)];}['getRefreshToken'](){const _0x454d4f=_0x475d0a;return _[_0x454d4f(0x187)](this[_0x454d4f(0xee)])?'':this[_0x454d4f(0xee)];}[_0x475d0a(0x170)](_0x47f5b0){this['refreshToken']=_0x47f5b0;}[_0x475d0a(0x102)](){const _0x5b2741=_0x475d0a;return this['getTokenType']()+'\x20'+this[_0x5b2741(0xd0)]();}['isAuthed'](){const _0x47d844=_0x475d0a;return this['getTokenType']()[_0x47d844(0x13c)]>0x0&&this[_0x47d844(0xd0)]()['length']>0x0;}[_0x475d0a(0x13f)](){const _0x3df0d2=_0x475d0a;return this[_0x3df0d2(0xee)]='',this[_0x3df0d2(0x131)]='',this;}async[_0x475d0a(0x117)](){const _0x308ba6=_0x475d0a;return await local[_0x308ba6(0x156)](_0x308ba6(0x162),_0x308ba6(0x12d),this[_0x308ba6(0x172)]()),this;}[_0x475d0a(0x172)](){const _0x409a17=_0x475d0a;var _0x23e797={'default_drive_id':this[_0x409a17(0x180)](),'user_id':this[_0x409a17(0x12c)](),'token_type':this[_0x409a17(0xf7)](),'access_token':this[_0x409a17(0xd0)](),'refresh_token':this[_0x409a17(0x112)]()};return JSON[_0x409a17(0xfb)](_0x23e797);}}class OAuth{constructor(){const _0x5bbff3=_0x475d0a;this[_0x5bbff3(0x15b)]='',this[_0x5bbff3(0x131)]='',this['refreshToken']='';}static[_0x475d0a(0xcf)](_0x31d5ae){const _0x40ac24=_0x475d0a;console[_0x40ac24(0x127)]('OAuthobjectFrom-----\x20'),console['log'](_0x31d5ae);if(_['isEmpty'](_0x31d5ae))return new OAuth();let _0x55f3e2=JSON[_0x40ac24(0x12e)](_0x31d5ae),_0x4d660e=new OAuth();return _0x4d660e[_0x40ac24(0x15b)]=_0x55f3e2[_0x40ac24(0x12f)],_0x4d660e['accessToken']=_0x55f3e2['access_token'],_0x4d660e[_0x40ac24(0xee)]=_0x55f3e2[_0x40ac24(0x143)],_0x4d660e;}[_0x475d0a(0xf7)](){const _0x5d51a7=_0x475d0a;return _[_0x5d51a7(0x187)](this['tokenType'])?'':this['tokenType'];}[_0x475d0a(0xd0)](){const _0x12f670=_0x475d0a;return _['isEmpty'](this['accessToken'])?'':this[_0x12f670(0x131)];}[_0x475d0a(0x112)](){const _0x1acf0=_0x475d0a;return _['isEmpty'](this[_0x1acf0(0xee)])?'':this['refreshToken'];}[_0x475d0a(0x102)](){const _0x5d166e=_0x475d0a;return this[_0x5d166e(0xf7)]()+'\x20'+this[_0x5d166e(0xd0)]();}[_0x475d0a(0x13f)](){const _0x55890b=_0x475d0a;return this[_0x55890b(0xee)]='',this[_0x55890b(0x131)]='',this;}async[_0x475d0a(0x117)](){const _0x20ac2e=_0x475d0a;return await local['set']('ali',_0x20ac2e(0x126),this[_0x20ac2e(0x172)]()),this;}['toString'](){const _0x3b3f46=_0x475d0a;var _0x118f3c={'token_type':this[_0x3b3f46(0xf7)](),'access_token':this[_0x3b3f46(0xd0)](),'refresh_token':this[_0x3b3f46(0x112)]()};return JSON['stringify'](_0x118f3c);}}class Code{constructor(){const _0x41893c=_0x475d0a;this[_0x41893c(0xf6)]='';}static[_0x475d0a(0xcf)](_0x3b40c3){const _0xd9f7e0=_0x475d0a;if(_[_0xd9f7e0(0x187)](_0x3b40c3))return new Code();let _0x506567=JSON['parse'](_0x3b40c3),_0x3afc06=new Code();return _0x3afc06[_0xd9f7e0(0xf6)]=_0x506567[_0xd9f7e0(0xf6)],_0x3afc06;}[_0x475d0a(0xd8)](){const _0x4bf1bd=_0x475d0a;return _['isEmpty'](this[_0x4bf1bd(0xf6)])?'':this['redirectUri'];}['getCode'](){const _0x48a452=_0x475d0a;return this[_0x48a452(0xd8)]()[_0x48a452(0x114)]('code=')[0x1];}}class Item{constructor(_0x55ee5a){const _0x2418c3=_0x475d0a;this[_0x2418c3(0x136)]=[],this['nextMarker']='',this[_0x2418c3(0xf4)]=_0x55ee5a,this[_0x2418c3(0x145)]='',this['name']='',this[_0x2418c3(0x10f)]='',this[_0x2418c3(0xe2)]='',this[_0x2418c3(0xeb)]='',this[_0x2418c3(0x174)]='',this[_0x2418c3(0x122)]='';}static[_0x475d0a(0xcf)](_0x4174d7){const _0x22ffc9=_0x475d0a;if(_['isEmpty'](_0x4174d7))return new Item();let _0x4ca777=JSON[_0x22ffc9(0x12e)](_0x4174d7),_0x6ae688=new Item();return _0x6ae688[_0x22ffc9(0x154)]=typeof _0x4ca777[_0x22ffc9(0x123)]==_0x22ffc9(0xfc)?'':_0x4ca777[_0x22ffc9(0x123)],_0x6ae688['fileId']=typeof _0x4ca777['file_id']=='undefined'?'':_0x4ca777[_0x22ffc9(0xe1)],_0x6ae688[_0x22ffc9(0x145)]=typeof _0x4ca777[_0x22ffc9(0x10a)]=='undefined'?'':_0x4ca777[_0x22ffc9(0x10a)],_0x6ae688[_0x22ffc9(0xe7)]=typeof _0x4ca777[_0x22ffc9(0xe7)]==_0x22ffc9(0xfc)?'':_0x4ca777[_0x22ffc9(0xe7)],_0x6ae688[_0x22ffc9(0x10f)]=typeof _0x4ca777[_0x22ffc9(0x10f)]==_0x22ffc9(0xfc)?'':_0x4ca777[_0x22ffc9(0x10f)],_0x6ae688['fileExtension']=typeof _0x4ca777[_0x22ffc9(0x111)]=='undefined'?'':_0x4ca777[_0x22ffc9(0x111)],_0x6ae688[_0x22ffc9(0xeb)]=typeof _0x4ca777[_0x22ffc9(0xeb)]=='undefined'?'':_0x4ca777[_0x22ffc9(0xeb)],_0x6ae688[_0x22ffc9(0x174)]=typeof _0x4ca777[_0x22ffc9(0x174)]==_0x22ffc9(0xfc)?'':_0x4ca777['size'],_0x6ae688[_0x22ffc9(0x122)]=typeof _0x4ca777[_0x22ffc9(0xdc)]=='undefined'?'':_0x4ca777[_0x22ffc9(0xdc)],typeof _0x4ca777[_0x22ffc9(0x136)]!=_0x22ffc9(0xfc)&&Array[_0x22ffc9(0x11a)](_0x4ca777[_0x22ffc9(0x136)])&&!_[_0x22ffc9(0x187)](_0x4ca777['items'])&&_0x4ca777[_0x22ffc9(0x136)]['forEach'](function(_0x52899a){const _0x30db9a=_0x22ffc9;let _0x2fc86b=Item[_0x30db9a(0xcf)](JSON[_0x30db9a(0xfb)](_0x52899a));_0x6ae688[_0x30db9a(0x136)]['push'](_0x2fc86b);}),_0x6ae688;}[_0x475d0a(0x169)](){const _0x4c67cd=_0x475d0a;return _[_0x4c67cd(0x187)](this[_0x4c67cd(0x136)])?[]:this['items'];}[_0x475d0a(0x119)](){const _0x5e947b=_0x475d0a;return _['isEmpty'](this[_0x5e947b(0x154)])?'':this[_0x5e947b(0x154)];}[_0x475d0a(0xe8)](){const _0x5082db=_0x475d0a;return _[_0x5082db(0x187)](this[_0x5082db(0xf4)])?'':this[_0x5082db(0xf4)];}['getName'](){const _0x467f0c=_0x475d0a;return _[_0x467f0c(0x187)](this['name'])?'':this[_0x467f0c(0xe7)];}[_0x475d0a(0x124)](){const _0x120969=_0x475d0a;return _[_0x120969(0x187)](this[_0x120969(0x10f)])?'':this[_0x120969(0x10f)];}[_0x475d0a(0x113)](){const _0x2e8b65=_0x475d0a;return _[_0x2e8b65(0x187)](this[_0x2e8b65(0xe2)])?'':this[_0x2e8b65(0xe2)];}[_0x475d0a(0x185)](){const _0x543df9=_0x475d0a;return _[_0x543df9(0x187)](this[_0x543df9(0xeb)])?'':this[_0x543df9(0xeb)];}[_0x475d0a(0x120)](){return this['size']==0x0?'':'['+_0x5f2ae7['getSize'](this['size'])+']';}[_0x475d0a(0x176)](){const _0x5956e3=_0x475d0a;return _[_0x5956e3(0x187)](this['parent'])?'':'['+this[_0x5956e3(0x122)]+']';}['parentFunc'](_0x2bc127){const _0x3e7b00=_0x475d0a;return this[_0x3e7b00(0x122)]=_0x2bc127,this;}[_0x475d0a(0x129)](){const _0x153ffe=_0x475d0a;return this[_0x153ffe(0x176)]()+'\x20'+this[_0x153ffe(0xed)]()+'\x20'+this['getSize']();}}class Sub{constructor(){const _0x27438d=_0x475d0a;this[_0x27438d(0x13e)]='',this[_0x27438d(0xe7)]='',this['lang']='',this['format']='';}static[_0x475d0a(0xcd)](){return new Sub();}[_0x475d0a(0x183)](_0xddda04){const _0x1b8f13=_0x475d0a;return this[_0x1b8f13(0xe7)]=_0xddda04,this;}['setUrl'](_0x28433b){const _0x6310b8=_0x475d0a;return this[_0x6310b8(0x13e)]=_0x28433b,this;}['setLang'](_0x403e9a){return this['lang']=_0x403e9a,this;}['setFormat'](_0x510b5b){const _0x2c3149=_0x475d0a;return this[_0x2c3149(0xd6)]=_0x510b5b,this;}[_0x475d0a(0xd2)](_0x1c1623){const _0x3bb80d=_0x475d0a;switch(_0x1c1623){case _0x3bb80d(0xcc):return this[_0x3bb80d(0x177)]('text/vtt');case'ass':case'ssa':return this[_0x3bb80d(0x177)]('text/x-ssa');default:return this[_0x3bb80d(0x177)](_0x3bb80d(0x139));}}}const UA=_0x475d0a(0x159),CLIENT_ID=_0x475d0a(0xda);let quality={},tempIds=[],refreshToken='',shareToken='',shareId='',oauth=new OAuth(),user=new User(),driveInfo={},tmpFolderName='tmp_for_resource',curTmpFolderFileId='',log=_0x5f2ae7['log'];async function getUserCache(){const _0x3172e7=_0x475d0a;var _0x1ec031=await local[_0x3172e7(0x171)]('ali',_0x3172e7(0x12d));return _0x1ec031;}async function getOAuthCache(){const _0x10b9a0=_0x475d0a;var _0x453a02=await local[_0x10b9a0(0x171)]('ali','aliyundrive_oauth');return _0x453a02;}async function initSome(){const _0x51bdb3=_0x475d0a;tempIds=[];let _0x4ab022=await getOAuthCache();await log(_0x51bdb3(0x11c)+_0x4ab022),oauth=OAuth['objectFrom'](_0x4ab022),console[_0x51bdb3(0x13a)](_0x51bdb3(0xf9)),console[_0x51bdb3(0x13a)](oauth);let _0x2286d7=await getUserCache();console[_0x51bdb3(0x13a)](_0x2286d7),await log(_0x51bdb3(0x182)+_0x2286d7),user=User[_0x51bdb3(0xcf)](_0x2286d7),quality={'4K':_0x51bdb3(0x130),'2k':_0x51bdb3(0x104),'超清':_0x51bdb3(0xea),'高清':'HD','标清':'SD','流畅':'LD'};}function setRefreshToken(_0x3ca000){refreshToken=_0x3ca000;}function getToken(){const _0x2976e5=_0x475d0a;return user[_0x2976e5(0x112)]();}async function setShareId(_0x2d393c){const _0x5e37da=_0x475d0a;getOAuthCache()[_0x5e37da(0x13c)]==0x0&&await oauth['clean']()[_0x5e37da(0x117)](),getUserCache()[_0x5e37da(0x13c)]==0x0&&await user[_0x5e37da(0x13f)]()[_0x5e37da(0x117)](),shareId=_0x2d393c,await refreshShareToken();}function getHeader(){const _0x14cec3=_0x475d0a;var _0x1caa15={};return _0x1caa15[_0x14cec3(0xce)]=UA,_0x1caa15[_0x14cec3(0x16f)]=_0x14cec3(0x15e),_0x1caa15;}function getHeaderAuth(){const _0x2e59ce=_0x475d0a;var _0x495cd9={};_0x495cd9['x-share-token']=shareToken,_0x495cd9['X-Canary']=_0x2e59ce(0xef);if(user[_0x2e59ce(0xd5)]())_0x495cd9['authorization']=user['getAuthorization']();return _0x495cd9;}function getHeaderShare(){const _0x4d9780=_0x475d0a;var _0x4da1d6=getHeader();return _0x4da1d6[_0x4d9780(0x105)]=shareToken,_0x4da1d6['X-Canary']=_0x4d9780(0xef),_0x4da1d6;}function getHeaderOpen(){const _0x4acb6a=_0x475d0a;var _0x4cbfa4={};return console['debug'](_0x4acb6a(0x146)),console[_0x4acb6a(0x13a)](oauth),_0x4cbfa4[_0x4acb6a(0x11f)]=oauth[_0x4acb6a(0x102)](),_0x4cbfa4;}async function alist(_0xd7cae8,_0x1c8f86){const _0x20b6b8=_0x475d0a;let _0x27f623=_0x20b6b8(0x150)+_0xd7cae8,_0xf5f2a=await postJson(_0x27f623,_0x1c8f86,getHeader()),_0xed5ef7=_0xf5f2a[_0x20b6b8(0x109)];console[_0x20b6b8(0x13a)](_0x20b6b8(0x173)+_0xd7cae8),console[_0x20b6b8(0x13a)](_0xed5ef7);if(await isManyRequest(_0xed5ef7))return![];return oauth=await OAuth['objectFrom'](_0xed5ef7)['save'](),!![];}async function getString(_0x3f0365){const _0x83af22=_0x475d0a;let _0x35ad12=await req(_0x3f0365,{});return _0x35ad12[_0x83af22(0x109)];}async function postJson(_0x53da97,_0x1cb102,_0x106c3d){const _0x56505c=_0x475d0a;_0x106c3d[_0x56505c(0x142)]=_0x56505c(0x167);let _0x46da1c=await req(_0x53da97,{'headers':_0x106c3d,'method':_0x56505c(0xe6),'data':_0x1cb102});return _0x46da1c;}async function post(_0x1a5b50,_0x1bd558){const _0x2342e6=_0x475d0a;_0x1a5b50=_0x1a5b50[_0x2342e6(0xe3)](_0x2342e6(0x103))?_0x1a5b50:_0x2342e6(0x12a)+_0x1a5b50;let _0x2cd70a=await postJson(_0x1a5b50,_0x1bd558,getHeader());return _0x2cd70a[_0x2342e6(0x109)];}async function auth(_0x2e711e,_0x539d0d,_0x450932){const _0x4d132c=_0x475d0a;_0x2e711e=_0x2e711e[_0x4d132c(0xe3)]('https')?_0x2e711e:_0x4d132c(0x12a)+_0x2e711e;let _0x47047a=await postJson(_0x2e711e,_0x539d0d,getHeaderAuth());await log(_0x4d132c(0x15f)+_0x47047a['content']);if(_0x450932&&(_0x47047a[_0x4d132c(0xd1)]==0x190||_0x47047a[_0x4d132c(0xd1)]==0x191)&&await refreshAccessToken())return await log('auth--res--400'+_0x47047a[_0x4d132c(0x109)]),await auth(_0x2e711e,_0x539d0d,![]);if(_0x450932&&_0x47047a['code']==0x1ad)return await log(_0x4d132c(0xe5)+_0x47047a['content']),await auth(_0x2e711e,_0x539d0d,![]);return _0x47047a['content'];}async function shareFunc(_0x33bb85,_0x20c4e6){const _0x51d581=_0x475d0a;_0x33bb85=_0x33bb85[_0x51d581(0xe3)]('https')?_0x33bb85:'https://api.aliyundrive.com/'+_0x33bb85;let _0x18cc9a=getHeaderShare(),_0x590866=await postJson(_0x33bb85,_0x20c4e6,_0x18cc9a);return console[_0x51d581(0x13a)](_0x51d581(0x13b)+_0x33bb85),console[_0x51d581(0x13a)](_0x18cc9a),console[_0x51d581(0x13a)](_0x20c4e6),console['debug'](_0x590866),_0x590866[_0x51d581(0x109)];}async function oauthFunc(_0xc6dd7f,_0x136b31,_0x3c591c){const _0x3cfe09=_0x475d0a;_0xc6dd7f=_0xc6dd7f[_0x3cfe09(0xe3)](_0x3cfe09(0x103))?_0xc6dd7f:_0x3cfe09(0x11e)+_0xc6dd7f;let _0x3f751a=await postJson(_0xc6dd7f,_0x136b31,getHeaderOpen());await log('oauthFunc--res-1-'+_0xc6dd7f),await log('oauthFunc--res-1-'+JSON[_0x3cfe09(0xfb)](_0x3f751a));if(_0x3c591c&&(_0x3f751a[_0x3cfe09(0xd1)]==0x190||_0x3f751a['code']==0x191)&&await refreshOpenToken())return await log(_0x3cfe09(0xf1)+_0x3f751a[_0x3cfe09(0x109)]),await oauthFunc(_0xc6dd7f,_0x136b31,![]);return _0x3f751a[_0x3cfe09(0x109)];}async function isManyRequest(_0x566244){const _0x4cbd29=_0x475d0a;if(!(_0x566244[_0x4cbd29(0x166)]('Too\x20Many\x20Requests')>-0x1))return![];return await oauth['clean']()[_0x4cbd29(0x117)](),!![];}async function refreshShareToken(){const _0x2850fe=_0x475d0a;try{let _0x1b9661={};_0x1b9661[_0x2850fe(0x10a)]=shareId,_0x1b9661[_0x2850fe(0x189)]='';let _0x57ec20=await post('v2/share_link/get_share_token',_0x1b9661),_0x383e26=JSON[_0x2850fe(0x12e)](_0x57ec20);shareToken=_0x383e26['share_token'];}catch(_0x458cf4){console[_0x2850fe(0x13a)](_0x458cf4);}}async function refreshAccessToken(){const _0x2761b5=_0x475d0a;try{let _0x3eb65f={},_0x1b9846=user[_0x2761b5(0x112)]();_[_0x2761b5(0x187)](_0x1b9846)&&(_0x1b9846=refreshToken);_0x1b9846[_0x2761b5(0xe3)]('http')&&(_0x1b9846=await getString(_0x1b9846),_0x1b9846=_0x1b9846['trim']());_0x3eb65f['refresh_token']=_0x1b9846,_0x3eb65f['grant_type']=_0x2761b5(0x143),await log(_0x2761b5(0x149)+JSON['stringify'](_0x3eb65f));let _0x6463=await post(_0x2761b5(0x17a),_0x3eb65f);await log(_0x2761b5(0x148)+_0x6463),user=await User[_0x2761b5(0xcf)](_0x6463)[_0x2761b5(0x117)](),await log(_0x2761b5(0x157)+user['getDriveId']());if(_['isEmpty'](user['getAccessToken']()))throw new Error(_0x6463);return!![];}catch(_0x1a6f2d){return await log('refreshAccessToken---error-'+_0x1a6f2d[_0x2761b5(0xe4)]),console[_0x2761b5(0x13a)](_0x1a6f2d),await user['clean']()[_0x2761b5(0x117)](),!![];}}function _0x2ae1(){const _0x216394=['share_id','-----createTmpFolder-----','folder','14609vDTFfP','join','type','default_drive_id','file_extension','getRefreshToken','getExt','split','815ZkhJaU','getVideoPreviewPlayInfo===','save','parentFunc','getNextMarker','isArray','unshift','initSome----oauth-','user:base,file:all:read,file:all:write','https://open.aliyundrive.com/adrive/v1.0/','authorization','getSize','adrive/v2/batch','parent','next_marker','getType','阿里云盘','aliyundrive_oauth','log','https://open.aliyundrive.com/oauth/users/authorize?client_id=','getDisplayName','https://api.aliyundrive.com/','prototype','getUserId','aliyundrive_user','parse','token_type','UHD','accessToken','token','video','ASC','adrive/v2/file/list_by_share','items','push','backup_drive_id','application/x-subrip','debug','----shareFunc----','length','constructor','url','clean','2461506OgBhNE','copy---user-','Content-Type','refresh_token','hasOwnProperty','shareId','getHeaderOpen---','v2/batch','refreshAccessToken---result--','refreshAccessToken---body--','drive_id','curDriveInfo---','trace','99882ClAEVN','trashFile-----','application/x-mpegURL','https://api-cf.nn.ci/alist/ali_open/','resource_drive_id','121720JEKXvw','21324xXWquH','nextMarker','getDownloadUrl--fileId-','set','refreshAccessToken--user.driveId-','exception','Mozilla/5.0\x20(iPhone;\x20CPU\x20iPhone\x20OS\x2013_2_3\x20like\x20Mac\x20OS\x20X)\x20AppleWebKit/605.1.15\x20(KHTML,\x20like\x20Gecko)\x20Version/13.0.3\x20Mobile/15E148\x20Safari/604.1','avatar','tokenType','oauthRequest---','order_by','https://www.aliyundrive.com/','auth--res--','__proto__','getDownloadUrl---','ali','copy---result','application/octet-stream','live_transcoding_task_list','indexOf','application/json','ForbiddenNoPermission.File','getItems','driveId','toLowerCase','video_preview_play_info','openFile/getVideoPreviewPlayInfo','return\x20(function()\x20','Referer','setRefreshToken','get','toString','alist---','size','@@@','getParent','setFormat','error','user/getDriveInfo','https://auth.aliyundrive.com/v2/account/token','language','isSub','openFile/getDownloadUrl','marker','2595072ZXULGt','getDriveId','root','initSome----user-','setName','-----tmpFolderFileId-----','getCategory','612ublqqZ','isEmpty','{\x22requests\x22:[{\x22body\x22:{\x22file_id\x22:\x22{{data.fileId}}\x22,\x22drive_id\x22:\x22{{data.driveId}}\x22},\x22headers\x22:{\x22Content-Type\x22:\x22application/json\x22},\x22id\x22:\x220\x22,\x22method\x22:\x22POST\x22,\x22url\x22:\x22/recyclebin/trash\x22}],\x22resource\x22:\x22file\x22}','share_pwd','limit','vtt','create','User-Agent','objectFrom','getAccessToken','code','setExt','info','apply','isAuthed','format','live_transcoding_subtitle_task_list','getRedirectUri','14400','76917ccccd4441c39457a04f6084fb2f','body','parent_file_id','446252NbMsqD','console','adrive/v3/share_link/get_share_by_anonymous','recyclebinClear-----','file_id','fileExtension','startsWith','message','auth--res--429','post','name','getFileId','grant_type','FHD','category','removeExt','getName','refreshToken','client=Android,app=adrive,version=v4.3.1','------tmpFolderExists-------','oauthFunc--res-2-','1932xiudfA','template_id','fileId','bind','redirectUri','getTokenType','responses','initSome----','copy---','stringify','undefined','access_token','{\x22requests\x22:[{\x22body\x22:{\x22file_id\x22:\x22{{data.fileId}}\x22,\x22share_id\x22:\x22{{data.shareId}}\x22,\x22auto_rename\x22:true,\x22to_parent_file_id\x22:\x22{{data.tmpFolderFileId}}\x22,\x22to_drive_id\x22:\x22{{data.driveId}}\x22},\x22headers\x22:{\x22Content-Type\x22:\x22application/json\x22},\x22id\x22:\x220\x22,\x22method\x22:\x22POST\x22,\x22url\x22:\x22/file/copy\x22}],\x22resource\x22:\x22file\x22}','setUrl','userId','live_transcoding','getAuthorization','https','QHD','x-share-token','openFile/create','authorization_code','authorize','content'];_0x2ae1=function(){return _0x216394;};return _0x2ae1();}async function oauthRequest(){const _0x297408=_0x475d0a;try{let _0x2e1971={};_0x2e1971[_0x297408(0x108)]=0x1,_0x2e1971['scope']=_0x297408(0x11d);let _0x4ba4d3=_0x297408(0x128)+CLIENT_ID+'&redirect_uri=https://alist.nn.ci/tool/aliyundrive/callback&scope=user:base,file:all:read,file:all:write&state=',_0x23a922=await auth(_0x4ba4d3,_0x2e1971,!![]);return await log(_0x297408(0x15c)+_0x23a922),console['debug'](_0x297408(0x15c)),console['debug'](_0x23a922),await oauthRedirect(Code[_0x297408(0xcf)](_0x23a922)['getCode']());}catch(_0x20a5ac){return console[_0x297408(0x13a)](_0x20a5ac),![];}}async function oauthRedirect(_0x464a61){const _0x1c5877=_0x475d0a;try{let _0x4d9e11={};return _0x4d9e11[_0x1c5877(0xd1)]=_0x464a61,_0x4d9e11[_0x1c5877(0xe9)]=_0x1c5877(0x107),await alist(_0x1c5877(0xd1),_0x4d9e11);}catch(_0x114c46){return console[_0x1c5877(0x13a)](_0x114c46),await oauth[_0x1c5877(0x13f)]()[_0x1c5877(0x117)](),![];}}async function refreshOpenToken(){const _0x3cd037=_0x475d0a;try{if(_[_0x3cd037(0x187)](oauth['getRefreshToken']()))return await oauthRequest();let _0x2a7205={};return _0x2a7205[_0x3cd037(0xe9)]=_0x3cd037(0x143),_0x2a7205['refresh_token']=oauth[_0x3cd037(0x112)](),await alist(_0x3cd037(0x132),_0x2a7205);}catch(_0x3d6bf0){return console[_0x3cd037(0x13a)](_0x3d6bf0),oauth[_0x3cd037(0x13f)]()[_0x3cd037(0x117)](),![];}}async function getVod(_0x44edf2,_0x3a1577){const _0x5b9f62=_0x475d0a;let _0x159c79={};_0x159c79[_0x5b9f62(0x10a)]=shareId;let _0x6b815f=await post(_0x5b9f62(0xdf),_0x159c79),_0x187f1c=JSON[_0x5b9f62(0x12e)](_0x6b815f),_0x2a8932=[],_0x185d3e=[],_0x3164ad=getParentFileId(_0x3a1577,_0x187f1c),_0x143f2b=new Item(_0x3164ad);await listFiles(_0x143f2b,_0x2a8932,_0x185d3e);let _0x51f891=['原画','超清','高清'],_0x3048b2=[],_0x4529ae=[];for(var _0x2e60ee of _0x2a8932)_0x3048b2[_0x5b9f62(0x137)](_0x2e60ee[_0x5b9f62(0x129)]()+'$'+_0x2e60ee[_0x5b9f62(0xe8)]()+findSubs(_0x2e60ee[_0x5b9f62(0xed)](),_0x185d3e));for(var _0x30df75=0x0;_0x30df75<_0x51f891[_0x5b9f62(0x13c)];_0x30df75++)_0x4529ae[_0x5b9f62(0x137)](_0x3048b2['join']('#'));let _0x1b2b50={'vod_id':_0x44edf2,'vod_content':_0x44edf2,'vod_pic':_0x187f1c[_0x5b9f62(0x15a)],'vod_name':_0x187f1c['share_name'],'vod_play_url':_0x4529ae[_0x5b9f62(0x10e)]('$$$'),'vod_play_from':_0x51f891[_0x5b9f62(0x10e)]('$$$'),'type_name':_0x5b9f62(0x125),'vod_year':'','vod_area':'','vod_remarks':'','vod_actor':'','vod_director':''};return _0x1b2b50;}async function listFiles(_0x44c747,_0x3fe101,_0x4662ce){return await listFilesMarker(_0x44c747,_0x3fe101,_0x4662ce,'');}async function listFilesMarker(_0x12b384,_0x23dcbe,_0x2b629f,_0x17d2f3){const _0xf2d865=_0x475d0a;let _0x17a017={},_0x58f77e=[];_0x17a017[_0xf2d865(0xcb)]=0xc8,_0x17a017[_0xf2d865(0x10a)]=shareId,_0x17a017[_0xf2d865(0xdc)]=_0x12b384[_0xf2d865(0xe8)](),_0x17a017[_0xf2d865(0x15d)]=_0xf2d865(0xe7),_0x17a017['order_direction']=_0xf2d865(0x134);if(_0x17d2f3[_0xf2d865(0x13c)]>0x0)_0x17a017[_0xf2d865(0x17e)]=_0x17d2f3;let _0x1bcd30=Item[_0xf2d865(0xcf)](await shareFunc(_0xf2d865(0x135),_0x17a017));for(var _0x4b8202 of _0x1bcd30[_0xf2d865(0x169)]()){if(_0x4b8202[_0xf2d865(0x124)]()==_0xf2d865(0x10c))_0x58f77e[_0xf2d865(0x137)](_0x4b8202);else{if(_0x4b8202['getCategory']()=='video'||_0x4b8202[_0xf2d865(0x185)]()=='audio')_0x23dcbe[_0xf2d865(0x137)](_0x4b8202[_0xf2d865(0x118)](_0x12b384[_0xf2d865(0xed)]()));else _0x5f2ae7[_0xf2d865(0x17c)](_0x4b8202[_0xf2d865(0x113)]())&&_0x2b629f[_0xf2d865(0x137)](_0x4b8202);}}_0x1bcd30[_0xf2d865(0x119)]()['length']>0x0&&await listFilesMarker(_0x12b384,_0x23dcbe,_0x2b629f,_0x1bcd30[_0xf2d865(0x119)]());for(var _0x41704d of _0x58f77e){await listFiles(_0x41704d,_0x23dcbe,_0x2b629f);}}function getParentFileId(_0x51a121,_0x254338){const _0x1b764d=_0x475d0a;let _0xc0497=_0x254338['file_infos'];if(!_[_0x1b764d(0x187)](_0x51a121))return _0x51a121;if(_0xc0497[_0x1b764d(0x13c)]==0x0)return'';let _0x491fd2=_0xc0497[0x0];if(_0x491fd2[_0x1b764d(0x10f)]=='folder')return _0x491fd2['file_id'];if(_0x491fd2['type']=='file'&&_0x491fd2[_0x1b764d(0xeb)]==_0x1b764d(0x133))return'root';return'';}function pair(_0x5d750b,_0x4de629,_0x271dd1){const _0x1d5310=_0x475d0a;for(var _0x3ff9a0 of _0x4de629){var _0x1f881c=_0x5f2ae7[_0x1d5310(0xec)](_0x3ff9a0[_0x1d5310(0xed)]())[_0x1d5310(0x16b)]();if(_0x5d750b[_0x1d5310(0x166)](_0x1f881c)>-0x1||_0x1f881c[_0x1d5310(0x166)](_0x5d750b)>-0x1)_0x271dd1['push'](_0x3ff9a0);}}function findSubs(_0x3ede19,_0x4a8833){const _0x2c5c94=_0x475d0a;let _0x423c93=[];pair(_0x5f2ae7[_0x2c5c94(0xec)](_0x3ede19)['toLowerCase'](),_0x4a8833,_0x423c93);if(_0x423c93[_0x2c5c94(0x13c)]==0x0)for(var _0x4afa94 of _0x4a8833){_0x423c93[_0x2c5c94(0x137)](_0x4afa94);}let _0x4c164b='';for(var _0x2f7dbb of _0x423c93){_0x4c164b+='+'+_0x5f2ae7[_0x2c5c94(0xec)](_0x2f7dbb[_0x2c5c94(0xed)]())+_0x2c5c94(0x175)+_0x2f7dbb[_0x2c5c94(0x113)]()+_0x2c5c94(0x175)+_0x2f7dbb[_0x2c5c94(0xe8)]();}return _0x4c164b;}async function getSubs(_0x28986a){const _0xf7429c=_0x475d0a;let _0x2e50d2=[];for(var _0x5a6e4f of _0x28986a){if(!(_0x5a6e4f[_0xf7429c(0x166)](_0xf7429c(0x175))>-0x1))continue;let _0x482f1f=_0x5a6e4f[_0xf7429c(0x114)](_0xf7429c(0x175)),_0x50c7db=_0x482f1f[0x0],_0x2fa639=_0x482f1f[0x1],_0x290983=_0x482f1f[0x2],_0xb0a0ad=await getDownloadUrl(_0x290983);_0x2e50d2['push'](Sub[_0xf7429c(0xcd)]()[_0xf7429c(0x183)](_0x50c7db)['setExt'](_0x2fa639)['setUrl'](_0xb0a0ad));}return _0x2e50d2;}async function getDriveInfo(){const _0x5d01df=_0x475d0a;if(!_[_0x5d01df(0x187)](driveInfo)&&!_[_0x5d01df(0x187)](driveInfo[_0x5d01df(0x110)]))return driveInfo;let _0x3740f3=await oauthFunc(_0x5d01df(0x179),{},!![]),_0x56fde5=JSON[_0x5d01df(0x12e)](_0x3740f3);return driveInfo={'default_drive_id':_0x56fde5['default_drive_id'],'resource_drive_id':_0x56fde5[_0x5d01df(0x151)],'backup_drive_id':_0x56fde5[_0x5d01df(0x138)]},driveInfo;}async function getDriveId(){const _0x1768d7=_0x475d0a;let _0x419112=await getDriveInfo();console[_0x1768d7(0x13a)](_0x1768d7(0x14b)),console[_0x1768d7(0x13a)](_0x419112);if(!_[_0x1768d7(0x187)](_0x419112[_0x1768d7(0x151)]))return _0x419112['resource_drive_id'];return _0x419112[_0x1768d7(0x110)];}async function getDownloadUrl(_0x5be8a4){const _0x1f5ff6=_0x475d0a;let _0xd2176d=await getDriveId();console[_0x1f5ff6(0x13a)](_0x1f5ff6(0x155)),console[_0x1f5ff6(0x13a)](_0x5be8a4),tempIds[_0x1f5ff6(0x11b)](await copy(_0x5be8a4));let _0x604944={};_0x604944[_0x1f5ff6(0xe1)]=tempIds[0x0],_0x604944['drive_id']=_0xd2176d;let _0x4cffce=await oauthFunc(_0x1f5ff6(0x17d),_0x604944,!![]);return console[_0x1f5ff6(0x13a)]('getDownloadUrl---'),console[_0x1f5ff6(0x13a)](_0x4cffce),await log(_0x1f5ff6(0x161)+_0x4cffce),JSON[_0x1f5ff6(0x12e)](_0x4cffce)[_0x1f5ff6(0x13e)];}async function getVideoPreviewPlayInfo(_0xcfd481){const _0x160d91=_0x475d0a;let _0x253de2=await getDriveId();tempIds['unshift'](await copy(_0xcfd481));let _0x53d289={};_0x53d289[_0x160d91(0xe1)]=tempIds[0x0],_0x53d289[_0x160d91(0x14a)]=_0x253de2,_0x53d289[_0x160d91(0xeb)]=_0x160d91(0x101),_0x53d289['url_expire_sec']=_0x160d91(0xd9);let _0x42aaf3=await oauthFunc(_0x160d91(0x16d),_0x53d289,!![]);return console[_0x160d91(0x13a)](_0x160d91(0x116)),console[_0x160d91(0x13a)](_0x42aaf3),JSON[_0x160d91(0x12e)](_0x42aaf3)[_0x160d91(0x16c)];}async function playerContent(_0x2b625d){const _0x481d8d=_0x475d0a;try{await deleteTmpFolderAndRecreate();}catch(_0x107a85){console[_0x481d8d(0x13a)](_0x107a85);}try{let _0x1080b3=await getDownloadUrl(_0x2b625d[0x0]),_0x407ee4=await getSubs(_0x2b625d),_0x26b438=[];for(var _0x2a989c of _0x407ee4){_0x26b438[_0x481d8d(0x137)](_0x2a989c[_0x481d8d(0x13e)]);}return JSON[_0x481d8d(0xfb)]({'parse':0x0,'url':_0x1080b3,'header':getHeader(),'extra':{'subt':_0x26b438},'format':_0x481d8d(0x164),'subs':_0x407ee4});}catch(_0x2c79d4){console[_0x481d8d(0x13a)](_0x2c79d4);}}async function playerContentByFlag(_0x1b7f96,_0x5eb4bf){const _0x5df13e=_0x475d0a;try{await deleteTmpFolderAndRecreate();}catch(_0x2b81f7){console[_0x5df13e(0x13a)](_0x2b81f7);}try{let _0x2b98d2=await getVideoPreviewPlayInfo(_0x1b7f96[0x0]),_0xf32d95=getPreviewUrl(_0x2b98d2,_0x5eb4bf),_0xa8e494=await getSubs(_0x1b7f96),_0x507d22=getSubsByPlayInfo(_0x2b98d2);for(var _0x3b844d of _0x507d22){_0xa8e494[_0x5df13e(0x137)](_0x3b844d);}let _0x524736=[];for(var _0x1b1a81 of _0xa8e494){_0x524736[_0x5df13e(0x137)](_0x1b1a81['url']);}return JSON[_0x5df13e(0xfb)]({'parse':0x0,'url':_0xf32d95,'header':getHeader(),'extra':{'subt':_0x524736},'format':_0x5df13e(0x14f),'subs':_0xa8e494});}catch(_0x4f810b){console[_0x5df13e(0x13a)](_0x4f810b);}}function getPreviewUrl(_0x429883,_0x53b6ac){const _0x58aff7=_0x475d0a;if(!_0x429883[_0x58aff7(0x144)](_0x58aff7(0x165)))return'';let _0x5bb088=_0x429883[_0x58aff7(0x165)];for(var _0x15dcd8=0x0;_0x15dcd8<_0x5bb088['length'];++_0x15dcd8){let _0x8b3730=_0x5bb088[_0x15dcd8];if(_0x8b3730[_0x58aff7(0xf3)]==quality[_0x53b6ac])return _0x8b3730[_0x58aff7(0x13e)];}return _0x5bb088[0x0][_0x58aff7(0x13e)];}function getSubsByPlayInfo(_0x4a91e6){const _0x14f483=_0x475d0a;if(!_0x4a91e6[_0x14f483(0x144)](_0x14f483(0xd7)))return[];let _0x5adb38=_0x4a91e6[_0x14f483(0xd7)],_0x2506c2=[];for(var _0x59872f=0x0;_0x59872f<_0x5adb38['length'];++_0x59872f){let _0x5d089a=_0x5adb38[_0x59872f],_0x54730a=_0x5d089a[_0x14f483(0x17b)],_0xddba3a=_0x5d089a[_0x14f483(0x13e)];_0x2506c2[_0x14f483(0x137)](Sub['create']()[_0x14f483(0xff)](_0xddba3a)[_0x14f483(0x183)](_0x54730a)['setLang'](_0x54730a)[_0x14f483(0xd2)](_0x14f483(0xcc)));}return _0x2506c2;}async function copy(_0x1cc37d){const _0x43a1fc=_0x475d0a;await log(_0x43a1fc(0x141)+user['toString']());let _0x1d5900=_0x43a1fc(0xfe),_0x3ced75=await getDriveId(),_0x329511={'fileId':_0x1cc37d,'shareId':shareId,'driveId':_0x3ced75,'tmpFolderFileId':curTmpFolderFileId};_0x1d5900=jinja2(_0x1d5900,{'data':_0x329511}),await log(_0x43a1fc(0xfa)+_0x1d5900);let _0x3f4a02=await auth(_0x43a1fc(0x121),JSON[_0x43a1fc(0x12e)](_0x1d5900),!![]);await log(_0x43a1fc(0x163)+_0x3f4a02);if(_0x3f4a02[_0x43a1fc(0x166)](_0x43a1fc(0x168))>-0x1)return copy(_0x1cc37d);return JSON[_0x43a1fc(0x12e)](_0x3f4a02)[_0x43a1fc(0xf8)][0x0][_0x43a1fc(0xdb)][_0x43a1fc(0xe1)];}async function deleteTmpFolderAndRecreate(){const _0x3b1ff7=_0x475d0a;let _0x10af5f=await tmpFolderExistsFunc();console[_0x3b1ff7(0x13a)](_0x3b1ff7(0x184)),console[_0x3b1ff7(0x13a)](_0x10af5f),_0x10af5f&&(await trashFile(_0x10af5f),await recyclebinClear()),curTmpFolderFileId=await createTmpFolder();}async function trashFile(_0x328801){const _0x4ac5d1=_0x475d0a;let _0x46cabc=_0x4ac5d1(0x188),_0x57975f=await getDriveId(),_0x336d7={'fileId':_0x328801,'driveId':_0x57975f};_0x46cabc=jinja2(_0x46cabc,{'data':_0x336d7});let _0x189d93=await auth(_0x4ac5d1(0x147),JSON['parse'](_0x46cabc),!![]);return console[_0x4ac5d1(0x13a)](_0x4ac5d1(0x14e)),console[_0x4ac5d1(0x13a)](_0x189d93),!![];}async function recyclebinClear(){const _0x113592=_0x475d0a;let _0xca8e26=await getDriveId(),_0x3ac975={'drive_id':_0xca8e26},_0x128f24=await auth('v2/recyclebin/clear',_0x3ac975,!![]);return console[_0x113592(0x13a)](_0x113592(0xe0)),console[_0x113592(0x13a)](_0x128f24),!![];}async function createTmpFolder(){const _0x20a4b5=_0x475d0a;let _0x30869f=await tmpFolderExistsFunc();if(_0x30869f)return!![];let _0x52b279=await getDriveId(),_0x1f7c7e={'check_name_mode':'refuse','drive_id':_0x52b279,'name':tmpFolderName,'parent_file_id':_0x20a4b5(0x181),'type':_0x20a4b5(0x10c)},_0xcde860=await oauthFunc(_0x20a4b5(0x106),_0x1f7c7e,!![]);console['debug'](_0x20a4b5(0x10b)),console[_0x20a4b5(0x13a)](_0xcde860);let _0x5a8c34=JSON[_0x20a4b5(0x12e)](_0xcde860);if(_[_0x20a4b5(0x187)](_0x5a8c34[_0x20a4b5(0x14a)]))return![];return _0x5a8c34['file_id'];}async function tmpFolderExistsFunc(){const _0x425df8=_0x475d0a;let _0x13ae17=await getDriveId(),_0x461fbd={'drive_id':_0x13ae17,'parent_file_id':_0x425df8(0x181),'limit':0x64,'order_by':'updated_at','order_direction':'DESC'},_0x4f2a1e=await oauthFunc('openFile/list',_0x461fbd,!![]);console[_0x425df8(0x13a)](_0x425df8(0xf0)),console[_0x425df8(0x13a)](_0x4f2a1e);let _0x5de3b1=JSON[_0x425df8(0x12e)](_0x4f2a1e);if(_[_0x425df8(0x187)](_0x5de3b1[_0x425df8(0x136)]))return![];for(var _0x1fa9cf of _0x5de3b1['items']){if(_0x1fa9cf[_0x425df8(0xe7)]==tmpFolderName)return _0x1fa9cf[_0x425df8(0xe1)];}return![];}async function setToken(_0x5d2c52){user['setRefreshToken'](_0x5d2c52),await refreshAccessToken(),await refreshOpenToken();}export{initSome,setToken,setShareId,getVod,playerContent,playerContentByFlag};