Skip to content

Commit

Permalink
fix(route): aliyundrive (DIYgod#11943)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyRL committed Feb 23, 2023
1 parent 434af10 commit 30d016f
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions lib/v2/aliyundrive/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,33 @@ module.exports = async (ctx) => {
const { share_id, parent_file_id } = ctx.params;
const url = `https://www.aliyundrive.com/s/${share_id}${parent_file_id ? `/folder/${parent_file_id}` : ''}`;

const headers = {
referer: 'https://www.aliyundrive.com/',
origin: 'https://www.aliyundrive.com',
'x-canary': 'client=web,app=share,version=v2.3.1',
};

const shareRes = await got.post('https://api.aliyundrive.com/adrive/v3/share_link/get_share_by_anonymous', {
params: {
share_id,
},
json: {
share_id,
},
headers: {
referer: 'https://www.aliyundrive.com/',
origin: 'https://www.aliyundrive.com',
'x-canary': 'client=web,app=share,version=v2.3.1',
},
headers,
});

const tokenRes = await got.post('https://api.aliyundrive.com/v2/share_link/get_share_token', {
headers: {
referer: 'https://www.aliyundrive.com/',
origin: 'https://www.aliyundrive.com',
'x-canary': 'client=web,app=share,version=v2.3.1',
},
headers,
json: {
share_id,
},
});
const share_token = tokenRes.data.share_token;

const listRes = await got.post('https://api.aliyundrive.com/v2/file/list', {
const listRes = await got.post('https://api.aliyundrive.com/adrive/v2/file/list_by_share', {
headers: {
referer: 'https://www.aliyundrive.com/',
origin: 'https://www.aliyundrive.com',
'x-canary': 'client=web,app=share,version=v2.3.1',
...headers,
'x-share-token': share_token,
},
json: {
Expand Down

0 comments on commit 30d016f

Please sign in to comment.