🐛 fix: 修复 xhs 无法解析问题

This commit is contained in:
zhiyu 2024-08-03 10:03:18 +08:00
parent 8565b34f4a
commit 45505cf550
3 changed files with 25 additions and 6 deletions

View File

@ -23,10 +23,12 @@ import {
} from "../utils/bilibili.js"; } from "../utils/bilibili.js";
import { downloadM3u8Videos, mergeAcFileToMp4, parseM3u8, parseUrl } from "../utils/acfun.js"; import { downloadM3u8Videos, mergeAcFileToMp4, parseM3u8, parseUrl } from "../utils/acfun.js";
import { import {
BILI_DEFAULT_INTRO_LEN_LIMIT, COMMON_USER_AGENT, BILI_DEFAULT_INTRO_LEN_LIMIT,
COMMON_USER_AGENT,
DIVIDING_LINE, DIVIDING_LINE,
douyinTypeMap, douyinTypeMap,
HELP_DOC, IMAGE_TRANSLATION_PROMPT, HELP_DOC,
IMAGE_TRANSLATION_PROMPT,
REDIS_YUNZAI_ISOVERSEA, REDIS_YUNZAI_ISOVERSEA,
REDIS_YUNZAI_LAGRANGE, REDIS_YUNZAI_LAGRANGE,
SUMMARY_PROMPT, SUMMARY_PROMPT,
@ -35,13 +37,13 @@ import {
XHS_NO_WATERMARK_HEADER, XHS_NO_WATERMARK_HEADER,
} from "../constants/constant.js"; } from "../constants/constant.js";
import { import {
checkCommandExists, cleanFilename, checkCommandExists,
cleanFilename,
downloadAudio, downloadAudio,
downloadImg, downloadImg,
estimateReadingTime, estimateReadingTime,
formatBiliInfo, formatBiliInfo,
retryAxiosReq, retryAxiosReq,
saveJsonToFile,
secondsToTime, secondsToTime,
testProxy, testProxy,
truncateString truncateString
@ -63,9 +65,9 @@ import {
GENERAL_REQ_LINK, GENERAL_REQ_LINK,
MIYOUSHE_ARTICLE, MIYOUSHE_ARTICLE,
NETEASE_API_CN, NETEASE_API_CN,
NETEASE_SONG_DETAIL,
NETEASE_SONG_DOWNLOAD, NETEASE_SONG_DOWNLOAD,
NETEASE_TEMP_API, QQ_MUSIC_TEMP_API, NETEASE_TEMP_API,
QQ_MUSIC_TEMP_API,
TWITTER_TWEET_INFO, TWITTER_TWEET_INFO,
WEIBO_SINGLE_INFO, WEIBO_SINGLE_INFO,
WEISHI_VIDEO_INFO, WEISHI_VIDEO_INFO,
@ -214,6 +216,8 @@ export class tools extends plugin {
this.douyinCompression = this.toolsConfig.douyinCompression; this.douyinCompression = this.toolsConfig.douyinCompression;
// 加载抖音是否开启评论 // 加载抖音是否开启评论
this.douyinComments = this.toolsConfig.douyinComments; this.douyinComments = this.toolsConfig.douyinComments;
// 加载小红书Cookie
this.xiaohongshuCookie = this.toolsConfig.xiaohongshuCookie;
// 翻译引擎 // 翻译引擎
this.translateEngine = new Translate({ this.translateEngine = new Translate({
translateAppId: this.toolsConfig.translateAppId, translateAppId: this.toolsConfig.translateAppId,
@ -945,6 +949,8 @@ export class tools extends plugin {
id = /explore\/(\w+)/.exec(msgUrl)?.[1] || /discovery\/item\/(\w+)/.exec(msgUrl)?.[1]; id = /explore\/(\w+)/.exec(msgUrl)?.[1] || /discovery\/item\/(\w+)/.exec(msgUrl)?.[1];
} }
const downloadPath = `${ this.getCurDownloadPath(e) }`; const downloadPath = `${ this.getCurDownloadPath(e) }`;
// 注入ck
XHS_NO_WATERMARK_HEADER.cookie = this.xiaohongshuCookie;
// 获取信息 // 获取信息
fetch(`${ XHS_REQ_LINK }${ id }`, { fetch(`${ XHS_REQ_LINK }${ id }`, {
headers: XHS_NO_WATERMARK_HEADER, headers: XHS_NO_WATERMARK_HEADER,

View File

@ -13,6 +13,8 @@ douyinCookie: '' # douyin's cookie, 格式odin_tt=xxx;passport_fe_beating_sta
douyinCompression: true # true-压缩false-不压缩;是否使用压缩视频格式的抖音(默认使用),使用后加速视频发送 douyinCompression: true # true-压缩false-不压缩;是否使用压缩视频格式的抖音(默认使用),使用后加速视频发送
douyinComments: false # true-开启评论false-关闭评论 douyinComments: false # true-开启评论false-关闭评论
xiaohongshuCookie: '' # 2024-8-2后反馈必须使用ck不然无法解析
queueConcurrency: 1 # 【目前只涉及哔哩哔哩的下载】根据服务器性能设置可以并发下载的个数如果你的服务器比较强劲就选择4~12较弱就一个一个下载选择1 queueConcurrency: 1 # 【目前只涉及哔哩哔哩的下载】根据服务器性能设置可以并发下载的个数如果你的服务器比较强劲就选择4~12较弱就一个一个下载选择1
videoDownloadConcurrency: 1 # 下载视频是否使用多线程如果不使用默认是1如果使用根据服务器进行选择如果不确定是否可以用4即可高性能服务器随意4~12都可以看CPU的实力 videoDownloadConcurrency: 1 # 下载视频是否使用多线程如果不使用默认是1如果使用根据服务器进行选择如果不确定是否可以用4即可高性能服务器随意4~12都可以看CPU的实力

View File

@ -133,6 +133,17 @@ export function supportGuoba() {
component: "Switch", component: "Switch",
required: false, required: false,
}, },
{
field: "tools.xiaohongshuCookie",
label: "小红书的Cookie",
bottomHelpMessage:
"2024-8-2后反馈必须使用ck不然无法解析",
component: "Input",
required: false,
componentProps: {
placeholder: "请输入小红书的Cookie",
},
},
{ {
field: "tools.queueConcurrency", field: "tools.queueConcurrency",
label: "(高级)队列长度", label: "(高级)队列长度",