feat: 新增论文解析

This commit is contained in:
zhiyu1998 2023-02-21 12:45:48 +08:00
parent 0fb26456a0
commit 1c69ded59a
6 changed files with 111 additions and 62 deletions

View File

@ -141,8 +141,8 @@ async tuiimg (e) {
感谢以下朋友的支持!(排名不分多少)
| 昵称 | 赞助 |
|:---------------:|-----|
| n | 13 |
|:---------------:|------|
| n | 13*4 |
| 一杯凉 | 30 |
| 左轮ps. 我导师,泪目!) | 13 |
| mitsuha | 13 |

View File

@ -61,6 +61,10 @@ export class tools extends plugin {
reg: "(.*)(xhslink.com|xiaohongshu.com)",
fnc: "redbook",
},
{
reg: "(.*)(doi.org)",
fnc: "literature"
}
],
});
// http://api.tuwei.space/girl
@ -576,6 +580,28 @@ export class tools extends plugin {
return true;
}
// 文献解析
async literature (e) {
const litReg = /(http:|https:)\/\/doi.org\/[A-Za-z\d._?%&+\-=\/#@]*/
const url = litReg.exec(e.msg.trim())[0];
const waitList = [
"https://sci-hub.se/",
"https://sci-hub.st/",
"https://sci-hub.do/",
"https://sci-hubtw.hkvisa.net/",
"https://sci-hub.ren/",
"https://sci-hub.ee/",
"https://sci-hub.ru/",
];
const flag = /doi.org\/(.*)/.exec(url)[1];
const newWaitList = waitList.map((item) => {
return item + flag;
});
await Promise.race(newWaitList).then(resp => {
e.reply(resp)
})
}
async downBili (title, videoUrl, audioUrl) {
return Promise.all([
downloadBFile(
@ -642,4 +668,23 @@ export class tools extends plugin {
});
});
}
// 工具下载pdf文件
async downloadPDF (url, filename) {
return axios({
url: url,
responseType: "stream",
headers: {
"User-Agent":
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36",
},
}).then((response) => {
const writer = fs.createWriteStream(filename);
response.data.pipe(writer);
return new Promise((resolve, reject) => {
writer.on("finish", resolve);
writer.on("error", reject);
});
});
}
}

View File

@ -58,6 +58,9 @@
- icon: redbook
title: "小红书"
desc: 小红书分享实时下载
- icon: literature
title: "论文"
desc: SCI论文实时解析
- group: 其他指令[实验]
list:
- icon: update

View File

@ -2,6 +2,7 @@
version: 1.0.6,
data:
[
增加<span class="cmd">SCI论文</span>解析,
适配<span class="cmd">锅巴</span>插件,方便查看和修改配置,
增加<span class="cmd">小红书</span>的图片解析,
添加<span class="cmd">#R帮助</span>获取插件帮助,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 KiB

After

Width:  |  Height:  |  Size: 378 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB