From acac1f6c109867031eb69a42c97b3e6d397af17b Mon Sep 17 00:00:00 2001
From: src48597962 <48597962@qq.com>
Date: Fri, 24 Mar 2023 21:21:55 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'test.js'?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
test.js | 39 +++++++++++++++++----------------------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/test.js b/test.js
index 8db35322..96a35419 100644
--- a/test.js
+++ b/test.js
@@ -1,26 +1,21 @@
-function (input) {
- let list = JSON.parse(request('https://yunpan1.com/api/discussions?include=user,lastPostedUser,mostRelevantPost,mostRelevantPost.user,tags,tags.parent,firstPost&filter[q]='+input+' tag:video1&filter[tag]=video1&sort&page[offset]=0', {
- timeout: 5000
- })).included;
+function(input) {
+ let headers = {
+ 'content-type': 'application/json;charset=UTF-8',
+ "referer": "https://www.aliyundrive.com/",
+ "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.41",
+ };
+ require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAliPublic.js');
+ let userinfo = JSON.parse(request('https://auth.aliyundrive.com/v2/account/token', { headers: headers, body: {"refresh_token":alitoken,"grant_type":"refresh_token"}, method: 'POST', timeout: 3000 })).access_token;
+ headers.authorization = "Bearer " + userinfo.access_token;
+ let drive_id = userinfo.default_drive_id;
+ let body = {"drive_id":drive_id,"limit":20,"query":"name match \""+input+"\" and type = \"folder\"","image_thumbnail_process":"image/resize,w_200/format,jpeg","image_url_process":"image/resize,w_1920/format,jpeg","video_thumbnail_process":"video/snapshot,t_1000,f_jpg,ar_auto,w_300","order_by":"updated_at DESC"}
+ let list = JSON.parse(request('https://api.aliyundrive.com/adrive/v3/file/search', { headers: headers, body: body, method: 'POST', timeout: 3000 }));
- let data = [];
- list.forEach(item => {
- if(item.type == "posts"){
- let html = item.attributes.contentHtml;
- let htmls = html.split('
\n');
- for(let i=0;i0){
- let name = htmls[i-1].replace(/]+>/g,"");
- let url = htmls[i].match(/https.*?\"/)[0].replace(`"`,"");
- if(name.includes(input)&&url.includes('aliyundrive.com')){
- data.push({
- title: name,
- url: url
- })
- }
- }
- }
+ let data = list.map(item => {
+ return {
+ title: item.name,
+ url: "https://www.aliyundrive.com/drive/folder/" + item.file_id
}
})
return data;
-}
+}
\ No newline at end of file