mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 08:09:19 +00:00
✨ feat:适配专栏在某些移动端情况下无法解析的问题
This commit is contained in:
parent
835ab12c6e
commit
5badf280de
@ -770,9 +770,8 @@ export class tools extends plugin {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 处理专栏
|
// 处理专栏
|
||||||
if (e.msg !== undefined && e.msg.includes("read\/cv") || e.msg.includes("read\/mobile")) {
|
if (e.msg !== undefined && url.includes("read\/cv") || url.includes("read\/mobile")) {
|
||||||
await this.biliArticle(e);
|
await this.biliArticle(e, url);
|
||||||
this.linkShareSummary(e);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 动态处理
|
// 动态处理
|
||||||
@ -835,25 +834,31 @@ export class tools extends plugin {
|
|||||||
/**
|
/**
|
||||||
* 提取哔哩哔哩专栏
|
* 提取哔哩哔哩专栏
|
||||||
* @param e
|
* @param e
|
||||||
|
* @param url
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async biliArticle(e) {
|
async biliArticle(e, url) {
|
||||||
const cvid = e.msg.match(/read\/cv(\d+)/)?.[1] || e.msg.match(/read\/mobile\?id=(\d+)/)?.[1];
|
const cvid = url.match(/read\/cv(\d+)/)?.[1] || url.match(/read\/mobile\?id=(\d+)/)?.[1];
|
||||||
const articleResp = await fetch(BILI_ARTICLE_INFO.replace("{}", cvid), {
|
const articleResp = await fetch(BILI_ARTICLE_INFO.replace("{}", cvid), {
|
||||||
headers: {
|
headers: {
|
||||||
...BILI_HEADER
|
...BILI_HEADER
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const articleData = (await articleResp.json()).data;
|
const articleData = (await articleResp.json()).data;
|
||||||
const { origin_image_urls } = articleData;
|
const { title, author_name, origin_image_urls } = articleData;
|
||||||
if (origin_image_urls) {
|
if (origin_image_urls) {
|
||||||
|
const titleMsg = {
|
||||||
|
message: { type: "text", text: `标题:${title}\n作者:${author_name}` },
|
||||||
|
nickname: e.sender.card || e.user_id,
|
||||||
|
user_id: e.user_id,
|
||||||
|
}
|
||||||
await e.reply(Bot.makeForwardMsg(origin_image_urls.map(item => {
|
await e.reply(Bot.makeForwardMsg(origin_image_urls.map(item => {
|
||||||
return {
|
return {
|
||||||
message: segment.image(item),
|
message: segment.image(item),
|
||||||
nickname: e.sender.card || e.user_id,
|
nickname: e.sender.card || e.user_id,
|
||||||
user_id: e.user_id,
|
user_id: e.user_id,
|
||||||
}
|
}
|
||||||
})))
|
}).concat(titleMsg)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user