feat: add aliyundrive

This commit is contained in:
DIYgod 2022-09-08 21:37:37 +01:00
parent ba2df5d3d9
commit 140fbed60d
No known key found for this signature in database
GPG Key ID: D159328F47A80DCA
5 changed files with 88 additions and 0 deletions

View File

@ -1181,6 +1181,12 @@ JavDB 有多个备用域名,本路由默认使用永久域名 <https://javdb.c
<Route author="Fatpandac" example="/ajmide/10603594" path="/ajmide/:id" :paramsDesc="['播客 id可以从播客页面 URL 中找到']" radar="1" rssbud="1"/>
## 阿里云盘
### 文件列表
<Route author="DIYgod" example="/aliyundrive/files/XDFSyJ3J5wk/63035a070a078cf4e55e4b7ea3fd5bd269c4e41c" path="/aliyundrive/files/:share_id/:parent_file_id?" :paramsDesc="['分享 id可以从分享页面 URL 中找到', '文件夹 id可以从文件夹页面 URL 中找到']" radar="1" rssbud="1"/>
## 爱奇艺
### 用户视频

View File

@ -0,0 +1,63 @@
const got = require('@/utils/got');
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 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',
},
});
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',
},
json: {
share_id,
},
});
const share_token = tokenRes.data.share_token;
const listRes = await got.post('https://api.aliyundrive.com/v2/file/list', {
headers: {
referer: 'https://www.aliyundrive.com/',
origin: 'https://www.aliyundrive.com',
'x-canary': 'client=web,app=share,version=v2.3.1',
'x-share-token': share_token,
},
json: {
limit: 100,
order_by: 'created_at',
order_direction: 'DESC',
parent_file_id: parent_file_id || 'root',
share_id,
},
});
const result = listRes.data.items.map((item) => ({
title: item.name,
description: item.name + (item.thumbnail ? `<img src="${item.thumbnail}">` : ''),
link: url,
pubDate: item.created_at,
updated: item.updated_at,
guid: item.file_id,
}));
ctx.state.data = {
title: `${shareRes.data.display_name || `${share_id}${parent_file_id ? `-${parent_file_id}` : ''}`}-阿里云盘`,
link: url,
item: result,
};
};

View File

@ -0,0 +1,3 @@
module.exports = {
'/files/:share_id/:parent_file_id?': ['DIYgod'],
};

View File

@ -0,0 +1,13 @@
module.exports = {
'aliyundrive.com': {
_name: '阿里云盘',
www: [
{
title: '文件列表',
docs: 'https://docs.rsshub.app/programming.html#a-li-yun-pan',
source: ['/s/:share_id', '/s/:share_id/folder/:parent_file_id'],
target: '/aliyundrive/files/:share_id/:parent_file_id?',
},
],
},
};

View File

@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/files/:share_id/:parent_file_id?', require('./files'));
};