🎈 pref: 优化阿b直播解析

This commit is contained in:
zhiyu1998 2024-09-30 13:14:37 +08:00
parent b9bb9bd934
commit 5b1c59dfab

View File

@ -75,7 +75,7 @@ import {
downloadImg,
estimateReadingTime,
formatBiliInfo,
retryAxiosReq,
retryAxiosReq, saveJsonToFile,
secondsToTime,
testProxy,
truncateString,
@ -542,12 +542,17 @@ export class tools extends plugin {
// logger.info(streamId)
// 提取相关信息
const liveData = await this.getBiliStream(streamId);
// logger.info(liveData);
const { title, user_cover, keyframe, description, tags } = liveData.data.data;
// saveJsonToFile(liveData.data);
const { title, user_cover, keyframe, description, tags, live_time, parent_area_name, area_name } = liveData.data.data;
e.reply([
segment.image(user_cover),
segment.image(keyframe),
`${this.identifyPrefix}识别:哔哩哔哩直播,${title}${description ? `\n\n简述:${description}\n` : ''}${tags ? `标签:${tags}\n` : ''}`
[`${ this.identifyPrefix }识别:哔哩哔哩直播,${ title }`,
`${ description ? `📝 简述:${ description.replace(`<p>`, '').replace(`</p>`, '') }` : '' }`,
`${ tags ? `🔖 标签:${ tags }` : '' }`,
`📍 分区:${ parent_area_name ? `${ parent_area_name }` : '' }${ area_name ? `-${ area_name }` : '' }`,
`${ live_time ? `⏰ 直播时间:${ live_time }` : '' }`,
].filter(item => item.trim() !== "").join("\n")
]);
return true;
}