mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 08:09:19 +00:00
✨ feat: 新增快手解析(测试阶段 & 网页地址)
1. 新增快手解析(测试阶段),目前只支持网页地址解析 2. 修复b23解析可能出现的网络问题
This commit is contained in:
parent
15afc40c9f
commit
bb523d1be2
@ -301,7 +301,7 @@ export class tools extends plugin {
|
|||||||
let url = e.msg === undefined ? e.message.shift().data.replaceAll("\\", "") : e.msg.trim();
|
let url = e.msg === undefined ? e.message.shift().data.replaceAll("\\", "") : e.msg.trim();
|
||||||
// 短号处理
|
// 短号处理
|
||||||
if (url.includes("b23.tv")) {
|
if (url.includes("b23.tv")) {
|
||||||
const bShortUrl = bShortRex.exec(url)[0];
|
const bShortUrl = bShortRex.exec(url)?.[0];
|
||||||
await fetch(bShortUrl, {
|
await fetch(bShortUrl, {
|
||||||
method: "HEAD"
|
method: "HEAD"
|
||||||
}).then(resp => {
|
}).then(resp => {
|
||||||
@ -784,7 +784,55 @@ export class tools extends plugin {
|
|||||||
* @return {Promise<void>}
|
* @return {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async kuaishou(e) {
|
async kuaishou(e) {
|
||||||
|
// 例子:https://www.kuaishou.com/short-video/3xkfs8p4pnd67p4?authorId=3xkznsztpwetngu&streamSource=find&area=homexxbrilliant
|
||||||
|
// https://v.m.chenzhongtech.com/fw/photo/3xburnkmj3auazc
|
||||||
|
const msg = e.msg;
|
||||||
|
let video_id;
|
||||||
|
if (msg.includes('/fw/photo/')) {
|
||||||
|
video_id = msg.match(/\/fw\/photo\/([^/?]+)/)[1];
|
||||||
|
} else if (msg.includes("short-video")) {
|
||||||
|
video_id = msg.match(/short-video\/([^/?]+)/)[1];
|
||||||
|
} else {
|
||||||
|
e.reply("无法提取快手的信息,请重试或者换一个视频!")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 提取视频
|
||||||
|
const videoUrl = `https://www.kuaishou.com/short-video/${video_id}`;
|
||||||
|
|
||||||
|
// 发送GET请求
|
||||||
|
const response = await axios.get(videoUrl, {
|
||||||
|
headers: {
|
||||||
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
||||||
|
'Accept-Language': 'zh-CN,zh;q=0.9',
|
||||||
|
'Cache-Control': 'no-cache',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Cookie': 'kpf=PC_WEB; clientid=3; did=web_c5627223fe1e796669894e6cb74f1461; _ga=GA1.1.1139357938.1696318390; didv=1696329758000; _ga_0P9YPW1GQ3=GS1.1.1696659232.14.0.1696659232.0.0.0; kpn=KUAISHOU_VISION',
|
||||||
|
'Pragma': 'no-cache',
|
||||||
|
'Sec-Fetch-Dest': 'document',
|
||||||
|
'Sec-Fetch-Mode': 'navigate',
|
||||||
|
'Sec-Fetch-Site': 'none',
|
||||||
|
'Sec-Fetch-User': '?1',
|
||||||
|
'Upgrade-Insecure-Requests': '1',
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36',
|
||||||
|
'sec-ch-ua': '"Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"',
|
||||||
|
'sec-ch-ua-mobile': '?0',
|
||||||
|
'sec-ch-ua-platform': '"macOS"',
|
||||||
|
},
|
||||||
|
timeout: 10000 // 设置超时时间
|
||||||
|
});
|
||||||
|
|
||||||
|
// 使用正则表达式提取视频数据
|
||||||
|
const videoDataMatch = response.data.match(/"photoH265Url":"(.*?)"/);
|
||||||
|
let videoData = videoDataMatch ? videoDataMatch[1] : null;
|
||||||
|
if (!videoData) {
|
||||||
|
e.reply("快手解析失败,可能原因:解析太多暂时失效,过一段时间再解析!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.reply("识别:快手")
|
||||||
|
videoData = decodeURIComponent(videoData).replace(/\\u002F/g, '/');
|
||||||
|
this.downloadVideo(videoData).then(path => {
|
||||||
|
e.reply(segment.video(path + "/temp.mp4"));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,12 +47,12 @@
|
|||||||
- icon: redbook
|
- icon: redbook
|
||||||
title: "小红书"
|
title: "小红书"
|
||||||
desc: 小红书分享实时下载
|
desc: 小红书分享实时下载
|
||||||
|
- icon: kuaishou
|
||||||
|
title: "快手(测试阶段)"
|
||||||
|
desc: 快手分享实时下载
|
||||||
- icon: literature
|
- icon: literature
|
||||||
title: "论文"
|
title: "论文"
|
||||||
desc: SCI论文实时解析
|
desc: SCI论文实时解析
|
||||||
- icon: netease
|
|
||||||
title: "网易云音乐"
|
|
||||||
desc: 网易云音乐解析
|
|
||||||
- icon: bodian
|
- icon: bodian
|
||||||
title: "波点音乐"
|
title: "波点音乐"
|
||||||
desc: 波点云音乐点解析
|
desc: 波点云音乐点解析
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
- {
|
- {
|
||||||
version: 1.1.1,
|
version: 1.1.2,
|
||||||
data:
|
data:
|
||||||
[
|
[
|
||||||
|
新增<span class="cmd">快手解析</span>功能,
|
||||||
新增<span class="cmd">竹白百科</span>功能,
|
新增<span class="cmd">竹白百科</span>功能,
|
||||||
新增<span class="cmd">Instagram解析</span>功能,
|
|
||||||
重构<span class="cmd">翻译</span>功能,
|
重构<span class="cmd">翻译</span>功能,
|
||||||
适配<span class="cmd">锅巴</span>插件,方便查看和修改配置,
|
适配<span class="cmd">锅巴</span>插件,方便查看和修改配置,
|
||||||
添加<span class="cmd">#R帮助</span>获取插件帮助,
|
添加<span class="cmd">#R帮助</span>获取插件帮助,
|
||||||
|
BIN
resources/img/icon/kuaishou.png
Normal file
BIN
resources/img/icon/kuaishou.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
Loading…
x
Reference in New Issue
Block a user