mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🐞 fix: V1.3.5 修复bili解析AV视频的问题 & 适配网页端动态
1. 修复了bili解析AV视频问题(eg. 【av565798707?p=1&unique_k=114514),感谢Mix在群里提供issue 2. 适配网页端的bili动态 3. 修复bili动态无法使用的问题,感谢Mix在群里提供issue
This commit is contained in:
parent
e45ef43f23
commit
57c5d2b453
@ -321,16 +321,19 @@ export class tools extends plugin {
|
|||||||
// av处理
|
// av处理
|
||||||
const matched = url.match(/\/(AV|av)(\w+)/);
|
const matched = url.match(/\/(AV|av)(\w+)/);
|
||||||
if (matched) {
|
if (matched) {
|
||||||
url = url.replace(matched[0], av2BV(Number(matched[2])));
|
url = url.replace(matched[0].replace("\/", ""), av2BV(Number(matched[2])));
|
||||||
}
|
}
|
||||||
// 只提取音乐处理
|
// 只提取音乐处理
|
||||||
if (e.msg !== undefined && e.msg.includes("bili音乐")) {
|
if (e.msg !== undefined && e.msg.includes("bili音乐")) {
|
||||||
await this.biliMusic(e, url);
|
return await this.biliMusic(e, url);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
// 动态处理
|
// 动态处理
|
||||||
if (url.includes("t.bilibili.com")) {
|
if (url.includes("t.bilibili.com") || url.includes("bilibili.com\/opus")) {
|
||||||
url = this.biliDynamic(url, e);
|
if (_.isEmpty(this.biliSessData)) {
|
||||||
|
e.reply("检测到没有填写biliSessData,无法解析动态");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
url = this.biliDynamic(e, url, this.biliSessData);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 视频信息获取例子:http://api.bilibili.com/x/web-interface/view?bvid=BV1hY411m7cB
|
// 视频信息获取例子:http://api.bilibili.com/x/web-interface/view?bvid=BV1hY411m7cB
|
||||||
@ -407,13 +410,13 @@ export class tools extends plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 发送哔哩哔哩动态的算法
|
// 发送哔哩哔哩动态的算法
|
||||||
biliDynamic(url, e) {
|
biliDynamic(e, url, session) {
|
||||||
// 去除多余参数
|
// 去除多余参数
|
||||||
if (url.includes("?")) {
|
if (url.includes("?")) {
|
||||||
url = url.substring(0, url.indexOf("?"));
|
url = url.substring(0, url.indexOf("?"));
|
||||||
}
|
}
|
||||||
const dynamicId = /[^/]+(?!.*\/)/.exec(url)[0];
|
const dynamicId = /[^/]+(?!.*\/)/.exec(url)[0];
|
||||||
getDynamic(dynamicId).then(async resp => {
|
getDynamic(dynamicId, session).then(async resp => {
|
||||||
if (resp.dynamicSrc.length > 0) {
|
if (resp.dynamicSrc.length > 0) {
|
||||||
e.reply(`识别:哔哩哔哩动态, ${ resp.dynamicDesc }`);
|
e.reply(`识别:哔哩哔哩动态, ${ resp.dynamicDesc }`);
|
||||||
let dynamicSrcMsg = [];
|
let dynamicSrcMsg = [];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
- {
|
- {
|
||||||
version: 1.3.4,
|
version: 1.3.5,
|
||||||
data:
|
data:
|
||||||
[
|
[
|
||||||
新增<span class="cmd">🍉解析</span>功能,
|
新增<span class="cmd">🍉解析</span>功能,
|
||||||
|
@ -14,7 +14,7 @@ export const BILI_PLAY_STREAM = "https://api.bilibili.com/x/player/playurl?cid={
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态信息
|
* 动态信息
|
||||||
* https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/dynamic/content.md
|
* https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/dynamic/get_dynamic_detail.md
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
export const BILI_DYNAMIC = "https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/get_dynamic_detail?dynamic_id={}"
|
export const BILI_DYNAMIC = "https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/get_dynamic_detail?dynamic_id={}"
|
||||||
|
@ -227,14 +227,15 @@ export async function getVideoInfo(url) {
|
|||||||
* @param dynamicId
|
* @param dynamicId
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
export async function getDynamic(dynamicId) {
|
export async function getDynamic(dynamicId, SESSDATA) {
|
||||||
const dynamicApi = BILI_DYNAMIC.replace("{}", dynamicId);
|
const dynamicApi = BILI_DYNAMIC.replace("{}", dynamicId);
|
||||||
return axios.get(dynamicApi, {
|
return axios.get(dynamicApi, {
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent':
|
'User-Agent':
|
||||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36',
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36',
|
||||||
'referer': 'https://www.bilibili.com',
|
'referer': 'https://www.bilibili.com',
|
||||||
}
|
Cookie: `SESSDATA=${ SESSDATA }`
|
||||||
|
},
|
||||||
}).then(resp => {
|
}).then(resp => {
|
||||||
const dynamicData = resp.data.data.card
|
const dynamicData = resp.data.data.card
|
||||||
const card = JSON.parse(dynamicData.card)
|
const card = JSON.parse(dynamicData.card)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user