parent
6709f83f1b
commit
acac1f6c10
@ -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('<br>\n'); |
||||
for(let i=0;i<htmls.length;i++){ |
||||
if(htmls[i].includes('aliyundrive.com') && i>0){ |
||||
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; |
||||
} |
||||
} |
Loading…
Reference in new issue