From 430c605b468e5e18c497a162e7ee1f780152cd7a Mon Sep 17 00:00:00 2001 From: src48597962 <48597962@qq.com> Date: Thu, 16 Mar 2023 21:01:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20'test.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test.js diff --git a/test.js b/test.js new file mode 100644 index 00000000..8db35322 --- /dev/null +++ b/test.js @@ -0,0 +1,26 @@ +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; + + 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 + }) + } + } + } + } + }) + return data; +}