mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🐞 fix: V1.6.7 修复y2b解析问题
This commit is contained in:
parent
b83d4fa739
commit
fade911f54
20
README.md
20
README.md
@ -64,6 +64,19 @@ sudo apt-get install ffmpeg
|
|||||||
# Windows 参考:https://www.jianshu.com/p/5015a477de3c
|
# Windows 参考:https://www.jianshu.com/p/5015a477de3c
|
||||||
````
|
````
|
||||||
|
|
||||||
|
`油管解析`需要 `yt-dlp` 的依赖才能完成解析(三选一):
|
||||||
|
```shell
|
||||||
|
# 三选一
|
||||||
|
# ubuntu (国内 or 国外,且安装了snap)
|
||||||
|
snap install yt-dlp
|
||||||
|
# debian 海外
|
||||||
|
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o ~/.local/bin/yt-dlp
|
||||||
|
chmod a+rx ~/.local/bin/yt-dlp
|
||||||
|
# debian 国内
|
||||||
|
curl -L https://ghproxy.net/https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o ~/.local/bin/yt-dlp
|
||||||
|
chmod a+rx ~/.local/bin/yt-dlp
|
||||||
|
```
|
||||||
|
|
||||||
4. 【可选】小程序解析适配了:
|
4. 【可选】小程序解析适配了:
|
||||||
* 喵崽:[Yoimiya / Miao-Yunzai](https://gitee.com/yoimiya-kokomi/Miao-Yunzai)
|
* 喵崽:[Yoimiya / Miao-Yunzai](https://gitee.com/yoimiya-kokomi/Miao-Yunzai)
|
||||||
* TRSS:[时雨◎星空 / Yunzai](https://gitee.com/TimeRainStarSky/Yunzai)
|
* TRSS:[时雨◎星空 / Yunzai](https://gitee.com/TimeRainStarSky/Yunzai)
|
||||||
@ -165,18 +178,21 @@ git clone -b 1.5.1 https://gitee.com/kyrzy0416/rconsole-plugin.git
|
|||||||
- [插件库](https://gitee.com/Hikari666/Yunzai-Bot-plugins-index)
|
- [插件库](https://gitee.com/Hikari666/Yunzai-Bot-plugins-index)
|
||||||
|
|
||||||
## 🙏 贡献
|
## 🙏 贡献
|
||||||
🌸感谢下面的朋友对我插件的贡献(排名不分高低)🌸
|
🌸 感谢下面的朋友对我插件的贡献(排名不分高低)
|
||||||
* [好冷](https://gitee.com/hetangx) 提供Windows解决方案
|
* [好冷](https://gitee.com/hetangx) 提供Windows解决方案
|
||||||
* [一杯凉](https://gitee.com/yibeiliang) 提供小程序解析冲突解决方案
|
* [一杯凉](https://gitee.com/yibeiliang) 提供小程序解析冲突解决方案
|
||||||
* [x0rz4](https://gitee.com/x0rz4) 提供依赖掉包解决方案
|
* [x0rz4](https://gitee.com/x0rz4) 提供依赖掉包解决方案
|
||||||
|
|
||||||
|
|
||||||
🌸同时鸣谢感谢以下开发者对 `R插件` 出的贡献🌸:
|
🌸 同时鸣谢感谢以下开发者对 `R插件` 出的贡献:
|
||||||
|
|
||||||
<a href="https://github.com/zhiyu1998/rconsole-plugin/graphs/contributors">
|
<a href="https://github.com/zhiyu1998/rconsole-plugin/graphs/contributors">
|
||||||
<img src="https://contrib.rocks/image?repo=zhiyu1998/rconsole-plugin&max=1000" />
|
<img src="https://contrib.rocks/image?repo=zhiyu1998/rconsole-plugin&max=1000" />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
🌸 感谢以下框架的开源:
|
||||||
|
- [yt-dlp:A youtube-dl fork with additional features and fixes](https://github.com/yt-dlp/yt-dlp)
|
||||||
|
|
||||||
## ☕ 请我喝一杯瑞幸咖啡
|
## ☕ 请我喝一杯瑞幸咖啡
|
||||||
如果你觉得插件能帮助到你增进好友关系,那么你可以在有条件的情况下[请我喝一杯瑞幸咖啡](https://afdian.net/a/zhiyu1998),这是我开源这个插件的最大动力!
|
如果你觉得插件能帮助到你增进好友关系,那么你可以在有条件的情况下[请我喝一杯瑞幸咖啡](https://afdian.net/a/zhiyu1998),这是我开源这个插件的最大动力!
|
||||||
感谢以下朋友的支持!(排名不分多少)
|
感谢以下朋友的支持!(排名不分多少)
|
||||||
|
@ -7,6 +7,7 @@ import axios from "axios";
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import tunnel from "tunnel";
|
import tunnel from "tunnel";
|
||||||
import HttpProxyAgent from "https-proxy-agent";
|
import HttpProxyAgent from "https-proxy-agent";
|
||||||
|
import { execSync } from "child_process";
|
||||||
import { checkAndRemoveFile, deleteFolderRecursive, mkdirIfNotExists, readCurrentDir } from "../utils/file.js";
|
import { checkAndRemoveFile, deleteFolderRecursive, mkdirIfNotExists, readCurrentDir } from "../utils/file.js";
|
||||||
import {
|
import {
|
||||||
downloadBFile,
|
downloadBFile,
|
||||||
@ -1161,40 +1162,12 @@ export class tools extends plugin {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Perform the HTTP GET request
|
// Perform the HTTP GET request
|
||||||
const formData = {
|
const title = execSync(`yt-dlp --get-title https://www.youtube.com/shorts/JNdllQl3n0g ${isOversea ? "" : `--proxy ${this.myProxy}`}`)
|
||||||
"link": url,
|
e.reply(`识别:油管,${title}`);
|
||||||
"from": "ytbsaver"
|
const path = this.getCurDownloadPath(e);
|
||||||
}
|
execSync(`yt-dlp ${isOversea ? "" : `--proxy ${this.myProxy}`} -P ${path} ${url} -o "temp.%(ext)s" --merge-output-format "mp4"`)
|
||||||
const params = new URLSearchParams();
|
e.reply(segment.video(path + "/temp.mp4"));
|
||||||
Object.keys(formData).forEach(key => params.append(key, formData[key]));
|
await checkAndRemoveFile(path + "/temp.mp4");
|
||||||
|
|
||||||
const config = {
|
|
||||||
headers: {
|
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36",
|
|
||||||
"origin": "https://www.ytbsaver.com"
|
|
||||||
},
|
|
||||||
}
|
|
||||||
// 如果不是海外,则使用代理
|
|
||||||
if (!isOversea) {
|
|
||||||
config.httpsAgent = tunnel.httpsOverHttp({
|
|
||||||
proxy: {
|
|
||||||
host: this.proxyAddr,
|
|
||||||
port: this.proxyPort
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await axios.post("https://api.ytbvideoly.com/api/thirdvideo/parse", params.toString(), config);
|
|
||||||
|
|
||||||
const { title, /*thumbnail,*/ duration, formats } = response.data.data;
|
|
||||||
e.reply(`识别:油管,${ title }\n时长:${ formatSeconds(duration) }`);
|
|
||||||
if (formats.length > 0) {
|
|
||||||
// 大概率是720p
|
|
||||||
const videoUrl = formats?.[formats.length - 1].url;
|
|
||||||
this.downloadVideo(videoUrl, !isOversea).then(path => {
|
|
||||||
e.reply(segment.video(path + "/temp.mp4"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
throw error; // Rethrow the error so it can be handled by the caller
|
throw error; // Rethrow the error so it can be handled by the caller
|
||||||
|
Loading…
x
Reference in New Issue
Block a user