mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 08:09:19 +00:00
✨ feat: 增加B站番剧解析
This commit is contained in:
parent
eb70f27f8f
commit
f4fae9d8b6
@ -26,8 +26,9 @@ import {
|
||||
XHS_NO_WATERMARK_HEADER,
|
||||
} from "../constants/constant.js";
|
||||
import {
|
||||
ANIME_SERIES_SEARCH_LINK,
|
||||
BILI_EP_INFO,
|
||||
BILI_ONLINE,
|
||||
BILI_ONLINE, BILI_SSID_INFO,
|
||||
BILI_STREAM_INFO,
|
||||
BILI_SUMMARY,
|
||||
DY_COMMENT,
|
||||
@ -519,9 +520,8 @@ export class tools extends plugin {
|
||||
return true;
|
||||
}
|
||||
// 处理番剧
|
||||
if (url.includes("ep")) {
|
||||
const ep = url.match(/\/ep(\d+)/)?.[1];
|
||||
await this.biliEpInfo(ep, e);
|
||||
if (url.includes("play\/ep") || url.includes("play\/ss")) {
|
||||
await this.biliEpInfo(url, e);
|
||||
return true
|
||||
}
|
||||
// 处理专栏
|
||||
@ -615,11 +615,24 @@ export class tools extends plugin {
|
||||
|
||||
/**
|
||||
* 获取哔哩哔哩番剧信息
|
||||
* @param ep
|
||||
* @param url
|
||||
* @param e
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async biliEpInfo(ep, e) {
|
||||
async biliEpInfo(url, e) {
|
||||
let ep;
|
||||
// 处理ssid
|
||||
if (url.includes("play\/ss")) {
|
||||
const ssid = url.match(/\/ss(\d+)/)?.[1];
|
||||
let resp = await (await fetch(BILI_SSID_INFO.replace("{}", ssid), {
|
||||
headers: BILI_HEADER
|
||||
})).json()
|
||||
ep = (resp.result.main_section.episodes[0].share_url).replace("https://www.bilibili.com/bangumi/play/ep", "")
|
||||
}
|
||||
// 处理普通情况,上述情况无法处理的
|
||||
if (_.isEmpty(ep)) {
|
||||
ep = url.match(/\/ep(\d+)/)?.[1];
|
||||
}
|
||||
const resp = await (await fetch(BILI_EP_INFO.replace("{}", ep), {
|
||||
headers: BILI_HEADER
|
||||
})).json();
|
||||
@ -636,6 +649,7 @@ export class tools extends plugin {
|
||||
segment.image(resp.result.cover),
|
||||
`${ this.identifyPrefix }识别:哔哩哔哩番剧,${ result.title }\n🎯 评分: ${ result?.rating?.score ?? '-' } / ${ result?.rating?.count ?? '-' }\n📺 ${ result.new_ep.desc }, ${ result.seasons[0].new_ep.index_show }\n`,
|
||||
`${ formatBiliInfo(dataProcessMap) }`,
|
||||
`\n\n在线观看: ${ANIME_SERIES_SEARCH_LINK}${encodeURI(result.title)}`
|
||||
], true)
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,13 @@ export const BILI_ONLINE = "https://api.bilibili.com/x/player/online/total?bvid=
|
||||
*/
|
||||
export const BILI_EP_INFO = "https://api.bilibili.com/pgc/view/web/season?ep_id={}"
|
||||
|
||||
/**
|
||||
* 剧集基本信息
|
||||
* https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/bangumi/info.md
|
||||
* @type {string}
|
||||
*/
|
||||
export const BILI_SSID_INFO = "https://api.bilibili.com/pgc/web/season/section?season_id={}"
|
||||
|
||||
/**
|
||||
* 米游社网页端获取文章
|
||||
* https://github.com/UIGF-org/mihoyo-api-collect/blob/main/hoyolab/article/article.md#%E8%8E%B7%E5%8F%96%E5%AE%8C%E6%95%B4%E6%96%87%E7%AB%A0%E4%BF%A1%E6%81%AF
|
||||
@ -180,3 +187,9 @@ export const WEIBO_SINGLE_INFO = "https://m.weibo.cn/statuses/show?id={}"
|
||||
* @type {string}
|
||||
*/
|
||||
export const WEISHI_VIDEO_INFO = "https://h5.weishi.qq.com/webapp/json/weishi/WSH5GetPlayPage?feedid={}"
|
||||
|
||||
/**
|
||||
* 番剧搜索链接
|
||||
* @type {string}
|
||||
*/
|
||||
export const ANIME_SERIES_SEARCH_LINK = "https://ylu.cc/so.php?wd="
|
Loading…
x
Reference in New Issue
Block a user