ali.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. import dayjs from 'dayjs';
  2. import {IOS_UA} from './misc.js';
  3. import req from './req.js';
  4. import {ENV} from "./env.js";
  5. const apiUrl = 'https://api.aliyundrive.com';
  6. // const openApiUrl = 'https://open.aliyundrive.com/adrive/v1.0';
  7. const userUrl = 'https://user.aliyundrive.com'
  8. const subtitleExts = ['srt', 'ass', 'scc', 'stl', 'ttml'];
  9. class AliDrive {
  10. constructor() {
  11. this.shareTokenCache = {}; // 共享令牌缓存
  12. this.user = {}; // 用户信息
  13. this.oauth = {}; // OAuth 信息
  14. this.saveFileIdCaches = {};
  15. this.saveDirName = 'drpy'; // 保存目录名称
  16. this.CLIENT_ID = "76917ccccd4441c39457a04f6084fb2f";
  17. this.deviceId = 'PkDvH8q6GRgBASQOA6EMvOI8';
  18. this.saveDirId = null; // 保存目录ID
  19. this.sid = ''
  20. this.baseHeaders = {
  21. 'User-Agent': IOS_UA, // 用户代理
  22. Referer: 'https://www.aliyundrive.com/', // 引用来源
  23. };
  24. }
  25. // 初始化方法,加载本地配置
  26. async init() {
  27. if (this.token) {
  28. console.log('阿里token获取成功:' + this.token)
  29. }
  30. if (this.ali_refresh_token === '') {
  31. this.oauth.access_token = null
  32. } else {
  33. let exp = JSON.parse(CryptoJS.enc.Base64.parse(this.ali_refresh_token.split('.')[1]).toString(CryptoJS.enc.Utf8))
  34. let now = Math.floor(Date.now() / 1000)
  35. if (exp.exp < now) {
  36. this.oauth.access_token = null
  37. console.log('阿里ali_refresh_token已过期')
  38. } else {
  39. this.oauth.access_token = this.ali_refresh_token
  40. console.log('阿里ali_refresh_token未过期,继续使用,可使用时间截止到:' + (new Date(exp.exp * 1000)).toLocaleString())
  41. console.log('阿里ali_refresh_token获取成功:' + this.ali_refresh_token)
  42. }
  43. }
  44. }
  45. get token() {
  46. // console.log('env.cookie.quark:',ENV.get('quark_cookie'));
  47. return ENV.get('ali_token');
  48. }
  49. get ali_refresh_token() {
  50. // console.log('env.cookie.quark:',ENV.get('quark_cookie'));
  51. return ENV.get('ali_refresh_token');
  52. }
  53. // 从分享链接中提取分享ID和文件夹ID
  54. getShareData(url) {
  55. const regex = /https:\/\/www\.alipan\.com\/s\/([^\\/]+)(\/folder\/([^\\/]+))?|https:\/\/www\.aliyundrive\.com\/s\/([^\\/]+)(\/folder\/([^\\/]+))?/;
  56. const matches = regex.exec(url);
  57. if (matches) {
  58. return {
  59. shareId: matches[1] || matches[4],
  60. folderId: matches[3] || matches[6] || 'root',
  61. };
  62. }
  63. return null;
  64. }
  65. // 计算两个字符串的最长公共子序列(LCS)
  66. lcs(str1, str2) {
  67. if (!str1 || !str2) {
  68. return {
  69. length: 0,
  70. sequence: '',
  71. offset: 0,
  72. };
  73. }
  74. let sequence = '';
  75. const str1Length = str1.length;
  76. const str2Length = str2.length;
  77. const num = new Array(str1Length);
  78. let maxlen = 0;
  79. let lastSubsBegin = 0;
  80. for (let i = 0; i < str1Length; i++) {
  81. const subArray = new Array(str2Length);
  82. for (let j = 0; j < str2Length; j++) {
  83. subArray[j] = 0;
  84. }
  85. num[i] = subArray;
  86. }
  87. let thisSubsBegin = null;
  88. for (let i = 0; i < str1Length; i++) {
  89. for (let j = 0; j < str2Length; j++) {
  90. if (str1[i] !== str2[j]) {
  91. num[i][j] = 0;
  92. } else {
  93. if (i === 0 || j === 0) {
  94. num[i][j] = 1;
  95. } else {
  96. num[i][j] = 1 + num[i - 1][j - 1];
  97. }
  98. if (num[i][j] > maxlen) {
  99. maxlen = num[i][j];
  100. thisSubsBegin = i - num[i][j] + 1;
  101. if (lastSubsBegin === thisSubsBegin) {
  102. sequence += str1[i];
  103. } else {
  104. lastSubsBegin = thisSubsBegin;
  105. sequence = ''; // clear it
  106. sequence += str1.substr(lastSubsBegin, i + 1 - lastSubsBegin);
  107. }
  108. }
  109. }
  110. }
  111. }
  112. return {
  113. length: maxlen,
  114. sequence: sequence,
  115. offset: thisSubsBegin,
  116. };
  117. }
  118. // 找到最佳的最长公共子序列匹配
  119. findBestLCS(mainItem, targetItems) {
  120. const results = [];
  121. let bestMatchIndex = 0;
  122. for (let i = 0; i < targetItems.length; i++) {
  123. const currentLCS = this.lcs(mainItem.name, targetItems[i].name);
  124. results.push({target: targetItems[i], lcs: currentLCS});
  125. if (currentLCS.length > results[bestMatchIndex].lcs.length) {
  126. bestMatchIndex = i;
  127. }
  128. }
  129. const bestMatch = results[bestMatchIndex];
  130. return {allLCS: results, bestMatch: bestMatch, bestMatchIndex: bestMatchIndex};
  131. }
  132. // 延迟函数
  133. delay(ms) {
  134. return new Promise((resolve) => setTimeout(resolve, ms));
  135. }
  136. // 发送API请求
  137. async api(url, data, headers, retry) {
  138. headers = headers || {};
  139. const auth = url.startsWith('adrive/');
  140. Object.assign(headers, this.baseHeaders);
  141. if (auth) {
  142. await this.refreshAccessToken()
  143. Object.assign(headers, {
  144. Authorization: this.user.auth,
  145. });
  146. }
  147. const resp = await req
  148. .post(`${apiUrl}/${url}`, data, {
  149. headers: headers,
  150. })
  151. .catch((err) => {
  152. console.error(err);
  153. return err.response || {status: 500, data: {}};
  154. });
  155. if (resp.status === 401) {
  156. console.error('请求未授权,尝试刷新 Token 并重试');
  157. await this.refreshAccessToken();
  158. Object.assign(headers, {
  159. Authorization: this.user.auth,
  160. });
  161. return await this.api(url, data, headers, retry - 1);
  162. } else if (resp.status === 429 && retry > 0) {
  163. console.error('请求频繁,请稍后再试');
  164. await this.delay(1000);
  165. await this.refreshAccessToken();
  166. return await this.api(url, data, headers, retry - 1);
  167. }
  168. return resp.data || {};
  169. }
  170. // 发送开放API请求
  171. async openApi(url, data, headers, retry = 3) {
  172. headers = headers || {};
  173. let resp = ''
  174. if (url.startsWith('http')) {
  175. Object.assign(headers, {
  176. Authorization: "Bearer " + this.oauth.access_token,
  177. });
  178. resp = await req
  179. .post(`${url}`, data, {
  180. headers: headers,
  181. })
  182. .catch((err) => {
  183. console.error(err);
  184. return err.response || {status: 500, data: {}};
  185. });
  186. } else {
  187. Object.assign(headers, {
  188. Authorization: this.user.auth,
  189. });
  190. resp = await req
  191. .post(`${apiUrl}/${url}`, data, {
  192. headers: headers,
  193. })
  194. .catch((err) => {
  195. console.error(err);
  196. return err.response || {status: 500, data: {}};
  197. });
  198. }
  199. if (resp.status === 429 && retry > 0) {
  200. await this.delay(1000);
  201. return await this.api(url, data, headers, retry - 1);
  202. }
  203. return resp.data || {};
  204. }
  205. //alist获取授权码
  206. // async getCode(auth){
  207. // const url = `https://open.aliyundrive.com/oauth/users/authorize?client_id=${this.CLIENT_ID}&redirect_uri=https://alist.nn.ci/tool/aliyundrive/callback&scope=user:base,file:all:read,file:all:write&state=Ojo%3D&response_type=code&relogin=true`
  208. // let data = JSON.stringify({
  209. // "scope": "user:base,file:all:read,file:all:write",
  210. // "authorize": 1,
  211. // "drives": [
  212. // "backup",
  213. // "resource"
  214. // ],
  215. // "folder": ""
  216. // })
  217. // let headers = {
  218. // 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
  219. // 'Accept': 'application/json, text/plain, */*',
  220. // 'Accept-Encoding': 'gzip, deflate, br, zstd',
  221. // 'Content-Type': 'application/json',
  222. // }
  223. // Object.assign(headers, {
  224. // Authorization: auth,
  225. // });
  226. // const res = await req.post(url,data,{headers})
  227. // const parsedUrl = new URL(res.data.redirectUri);
  228. // return parsedUrl.searchParams.get("code");
  229. // }
  230. //
  231. // // 获取 OAuth Token
  232. // async openAuth() {
  233. // if (!this.oauth.access_token || this.oauth.expire_time - dayjs().unix() < 120 && this.user.auth) {
  234. // try {
  235. // const code = await this.getCode(this.user.auth)
  236. // const response = await req.post('https://api.nn.ci/alist/ali_open/code', {
  237. // "code": code,
  238. // "grant_type": "authorization_code",
  239. // "client_id": "",
  240. // "client_secret": ""
  241. // }, {
  242. // headers: {
  243. // 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
  244. // 'Content-Type': 'application/json',
  245. // 'origin': 'https://alist.nn.ci',
  246. // 'referer': 'https://alist.nn.ci/'
  247. // }
  248. // })
  249. // if (response.status === 200) {
  250. // this.oauth = response.data;
  251. // const info = JSON.parse(CryptoJS.enc.Base64.parse(this.oauth.access_token.split('.')[1]).toString(CryptoJS.enc.Utf8));
  252. // this.oauth.expire_time = info.exp;
  253. // this.oauth.auth = `${this.oauth.token_type} ${this.oauth.access_token}`;
  254. // await ENV.set('ali_refresh_token', this.oauth.access_token);
  255. // // await ENV.set('oauth_cache', this.oauth);
  256. // console.log("授权成功")
  257. // }
  258. // } catch(err){
  259. // if(err.status === '429'){
  260. // console.error('请求频繁,请稍后再试')
  261. // }else if(err.status === '401'){
  262. // console.error("授权未成功,请重新授权")
  263. // }
  264. // return err.response || {status: 500, data: {}};
  265. // }
  266. //
  267. // }else {
  268. // console.log("已授权")
  269. // }
  270. // }
  271. // 获取 drive_sid
  272. async getDriveSid() {
  273. let data = JSON.stringify({
  274. "scopes": [
  275. "user:base",
  276. "file:all:read",
  277. "file:all:write"
  278. ],
  279. "width": 300,
  280. "height": 300
  281. });
  282. let headers = {
  283. 'Content-Type': 'application/json'
  284. }
  285. let resp = await req.post('https://aliyundrive-oauth.messense.me/oauth/authorize/qrcode', data, {headers})
  286. if (resp.data.sid) {
  287. this.sid = resp.data.sid
  288. }
  289. }
  290. //drive_flag
  291. async getDriveFlag() {
  292. let body = {
  293. "authorize": 1,
  294. "scope": "user:base,file:all:read,file:all:write",
  295. "drives": ["backup", "resource"],
  296. "scopes": ["user:base", "file:all:read", "file:all:write"],
  297. "sid": this.sid
  298. }
  299. let headers = {
  300. 'authorization': this.user.auth
  301. };
  302. let resp = await req.post('https://open.aliyundrive.com/oauth/users/qrcode/authorize?sid=' + this.sid, body, {headers})
  303. return resp.data.result
  304. }
  305. //drive_status
  306. async getDriveCode() {
  307. let status = await req.get(`https://openapi.aliyundrive.com/oauth/qrcode/${this.sid}/status`)
  308. if (status.data.status === 'LoginSuccess') {
  309. return status.data.authCode
  310. }
  311. }
  312. // drive获取授权码
  313. async driveAuth() {
  314. await this.init()
  315. if (!this.oauth.access_token || this.oauth.expire_time - dayjs().unix() < 120 && this.user.auth) {
  316. let headers = this.baseHeaders
  317. Object.assign(headers, {
  318. 'Authorization': this.user.auth,
  319. })
  320. await this.getDriveSid()
  321. let flag = await this.getDriveFlag()
  322. if (flag) {
  323. let code = await this.getDriveCode()
  324. let data = {
  325. code: code,
  326. grant_type: "authorization_code"
  327. }
  328. let response = await req.post('https://aliyundrive-oauth.messense.me/oauth/access_token', data)
  329. if (response.status === 200) {
  330. this.oauth = response.data;
  331. const info = JSON.parse(CryptoJS.enc.Base64.parse(this.oauth.access_token.split('.')[1]).toString(CryptoJS.enc.Utf8));
  332. this.oauth.expire_time = info.exp;
  333. this.oauth.auth = `${this.oauth.token_type} ${this.oauth.access_token}`;
  334. await ENV.set('ali_refresh_token', this.oauth.access_token);
  335. // await ENV.set('oauth_cache', this.oauth);
  336. console.log("授权成功")
  337. }
  338. }
  339. } else {
  340. console.log("已授权,无需再授权")
  341. }
  342. }
  343. // 登录并获取用户信息
  344. async refreshAccessToken() {
  345. if (!this.user.user_id || this.user.expire_time - dayjs().unix() < 120) {
  346. let loginResp = await req
  347. .post(
  348. 'https://auth.aliyundrive.com/v2/account/token',
  349. {
  350. refresh_token: this.user.refresh_token || this.token,
  351. grant_type: 'refresh_token',
  352. },
  353. {headers: this.baseHeaders}
  354. )
  355. .catch((err) => {
  356. return err.response || {status: 500, data: {}};
  357. });
  358. if (loginResp.status === 200) {
  359. this.user = loginResp.data;
  360. this.user.expire_time = dayjs(loginResp.data.expire_time).unix();
  361. this.user.auth = `${this.user.token_type} ${this.user.access_token}`;
  362. ENV.set('ali_token', this.user.refresh_token);
  363. // await ENV.set('user_cache', this.user);
  364. } else {
  365. console.error('刷新 Access Token 失败');
  366. }
  367. }
  368. }
  369. // 清除保存目录中的文件
  370. async clearSaveDir() {
  371. const listData = await this.openApi(`adrive/v3/file/list`, {
  372. drive_id: this.user.drive.resource_drive_id,
  373. parent_file_id: this.saveDirId,
  374. limit: 100,
  375. order_by: 'updated_at',
  376. order_direction: 'DESC',
  377. });
  378. if (listData.items) {
  379. for (const item of listData.items) {
  380. const del = await this.openApi(`v2/recyclebin/trash`, {
  381. drive_id: this.user.drive.resource_drive_id,
  382. file_id: item.file_id,
  383. });
  384. console.log(del);
  385. }
  386. }
  387. }
  388. // 创建保存目录
  389. async createSaveDir(clean) {
  390. if (!this.user.device_id) return;
  391. if (this.saveDirId) {
  392. if (clean) await this.clearSaveDir();
  393. return;
  394. }
  395. let driveInfo = await this.userApi(`/v2/user/get`, {});
  396. if (driveInfo.resource_drive_id) {
  397. this.user.drive = driveInfo;
  398. const resource_drive_id = driveInfo.resource_drive_id;
  399. const listData = await this.openApi(`adrive/v3/file/list`, {
  400. drive_id: resource_drive_id,
  401. parent_file_id: 'root',
  402. limit: 100,
  403. order_by: 'updated_at',
  404. order_direction: 'DESC',
  405. });
  406. if (listData.items) {
  407. for (const item of listData.items) {
  408. if (item.name === this.saveDirName) {
  409. this.saveDirId = item.file_id;
  410. await this.clearSaveDir();
  411. break;
  412. }
  413. }
  414. if (!this.saveDirId) {
  415. const create = await this.openApi(`adrive/v2/file/createWithFolders`, {
  416. check_name_mode: 'refuse',
  417. drive_id: resource_drive_id,
  418. name: this.saveDirName,
  419. parent_file_id: 'root',
  420. type: 'folder',
  421. });
  422. console.log(create);
  423. if (create.file_id) {
  424. this.saveDirId = create.file_id;
  425. }
  426. }
  427. }
  428. }
  429. }
  430. // 获取共享令牌
  431. async getShareToken(shareData) {
  432. if (!this.shareTokenCache[shareData.shareId] || this.shareTokenCache[shareData.shareId].expire_time - dayjs().unix() < 120) {
  433. delete this.shareTokenCache[shareData.shareId];
  434. const shareToken = await this.api(`v2/share_link/get_share_token`, {
  435. share_id: shareData.shareId,
  436. share_pwd: shareData.sharePwd || '',
  437. });
  438. if (shareToken.expire_time) {
  439. shareToken.expire_time = dayjs(shareToken.expire_time).unix();
  440. this.shareTokenCache[shareData.shareId] = shareToken;
  441. }
  442. }
  443. }
  444. // 根据分享链接获取文件列表
  445. async getFilesByShareUrl(shareInfo) {
  446. const shareData = typeof shareInfo === 'string' ? this.getShareData(shareInfo) : shareInfo;
  447. if (!shareData) return [];
  448. await this.getShareToken(shareData);
  449. if (!this.shareTokenCache[shareData.shareId]) return [];
  450. const videos = [];
  451. const subtitles = [];
  452. const listFile = async (shareId, folderId, nextMarker) => {
  453. const listData = await this.api(
  454. `adrive/v2/file/list_by_share`,
  455. {
  456. share_id: shareId,
  457. parent_file_id: folderId,
  458. limit: 200,
  459. order_by: 'name',
  460. order_direction: 'ASC',
  461. marker: nextMarker || '',
  462. },
  463. {
  464. 'X-Share-Token': this.shareTokenCache[shareId].share_token,
  465. }
  466. );
  467. const items = listData.items;
  468. if (!items) return [];
  469. if (listData.next_marker) {
  470. const nextItems = await listFile(shareId, folderId, listData.next_marker);
  471. for (const item of nextItems) {
  472. items.push(item);
  473. }
  474. }
  475. const subDir = [];
  476. for (const item of items) {
  477. if (item.type === 'folder') {
  478. subDir.push(item);
  479. } else if (item.type === 'file' && item.category === 'video') {
  480. if (item.size < 1024 * 1024 * 5) continue;
  481. item.name = item.name.replace(/玩偶哥.*【神秘的哥哥们】/g, '');
  482. videos.push(item);
  483. } else if (item.type === 'file' && subtitleExts.some((x) => item.file_extension.endsWith(x))) {
  484. subtitles.push(item);
  485. }
  486. }
  487. for (const dir of subDir) {
  488. const subItems = await listFile(dir.share_id, dir.file_id);
  489. for (const item of subItems) {
  490. items.push(item);
  491. }
  492. }
  493. return items;
  494. };
  495. await listFile(shareData.shareId, shareData.folderId);
  496. if (subtitles.length > 0) {
  497. videos.forEach((item) => {
  498. const matchSubtitle = this.findBestLCS(item, subtitles);
  499. if (matchSubtitle.bestMatch) {
  500. item.subtitle = matchSubtitle.bestMatch.target;
  501. }
  502. });
  503. }
  504. return videos;
  505. }
  506. // 保存文件到指定目录
  507. async save(shareId, fileId, clean) {
  508. await this.refreshAccessToken();
  509. await this.driveAuth()
  510. // await this.openAuth();
  511. await this.createSaveDir(clean);
  512. if (clean) {
  513. const saves = Object.keys(this.saveFileIdCaches);
  514. for (const save of saves) {
  515. delete this.saveFileIdCaches[save];
  516. }
  517. }
  518. if (!this.saveDirId) return null;
  519. await this.getShareToken({
  520. shareId: shareId,
  521. });
  522. if (!this.shareTokenCache[shareId]) return null;
  523. const saveResult = await this.api(
  524. `adrive/v2/file/copy`,
  525. {
  526. file_id: fileId,
  527. share_id: shareId,
  528. auto_rename: true,
  529. to_parent_file_id: this.saveDirId,
  530. to_drive_id: this.user.drive.resource_drive_id,
  531. },
  532. {
  533. 'X-Share-Token': this.shareTokenCache[shareId].share_token,
  534. }
  535. );
  536. if (saveResult.file_id) return saveResult.file_id;
  537. return false;
  538. }
  539. // 获取实时转码信息
  540. async getLiveTranscoding(shareId, fileId) {
  541. if (!this.saveFileIdCaches[fileId]) {
  542. const saveFileId = await this.save(shareId, fileId, true);
  543. if (!saveFileId) return null;
  544. this.saveFileIdCaches[fileId] = saveFileId;
  545. }
  546. const transcoding = await this.openApi(`v2/file/get_video_preview_play_info`, {
  547. file_id: this.saveFileIdCaches[fileId],
  548. drive_id: this.user.drive.resource_drive_id,
  549. category: 'live_transcoding',
  550. url_expire_sec: '14400',
  551. });
  552. if (transcoding.video_preview_play_info && transcoding.video_preview_play_info.live_transcoding_task_list) {
  553. return transcoding.video_preview_play_info.live_transcoding_task_list;
  554. }
  555. return null;
  556. }
  557. // 获取下载链接
  558. async getDownload(shareId, fileId) {
  559. if (!this.saveFileIdCaches[fileId]) {
  560. const saveFileId = await this.save(shareId, fileId, true);
  561. if (!saveFileId) return null;
  562. this.saveFileIdCaches[fileId] = saveFileId;
  563. }
  564. const down = await this.openApi(`https://open.aliyundrive.com/adrive/v1.0/openFile/getDownloadUrl`, {
  565. file_id: this.saveFileIdCaches[fileId],
  566. drive_id: this.user.drive.resource_drive_id,
  567. }, {
  568. 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) aDrive/6.7.3 Chrome/112.0.5615.165 Electron/24.1.3.7 Safari/537.36',
  569. 'Content-Type': 'application/json',
  570. 'x-canary': 'client=windows,app=adrive,version=v6.7.3',
  571. });
  572. if (down.url) {
  573. return down;
  574. }
  575. return null;
  576. }
  577. async userApi(url, param) {
  578. url = url.startsWith('http') ? url : `${userUrl}${url}`;
  579. let headers = {
  580. 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
  581. 'Accept': 'application/json, text/plain, */*',
  582. 'Content-Type': 'application/json',
  583. 'accept-language': 'zh-CN,zh;q=0.9',
  584. 'referer': 'https://www.alipan.com/'
  585. }
  586. Object.assign(headers, {
  587. Authorization: this.user.auth,
  588. });
  589. let resp = await req.post(url, {param}, {headers})
  590. if (resp.status === 200) {
  591. return resp.data
  592. } else {
  593. console.log("获取用户信息失败")
  594. return null
  595. }
  596. }
  597. }
  598. export const Ali = new AliDrive();