Well2333 / nonebot-plugin-bilichat

一个通过 OpenAI 来对b站视频进行总结的多功能 B站解析插件
GNU Affero General Public License v3.0
232 stars 10 forks source link

动态及专栏browser_shot字体问题 #220

Closed Yppup closed 4 months ago

Yppup commented 4 months ago

操作系统

Linux

Python 版本

3.10.8

NoneBot 版本

2.3.0

Bilichat 版本

5.10.2

描述问题

动态及专栏browser_shot字体无法正常显示。 03DBCCF9F1A00F1B9D53622CAEC680A5

插件的配置项

COMMAND_SEP=[""] COMMAND_START=[""] bilichat_cmd_start=""

bilichat_cd_time = 120 bilichat_neterror_retry = 3 bilichat_use_browser = True

截图或日志

后台无报错。

截屏2024-05-12 20 21 01
Well2333 commented 4 months ago

请添加debug级或更详细的日志,否则无法判断字体是否存在问题

Yppup commented 4 months ago

启动bot字体正常加载

05-12 22:34:42 [DEBUG] nonebot_plugin_bilichat | Loading font: sarasa-mono-sc-semibold.ttf
05-12 22:34:42 [DEBUG] nonebot_plugin_bilichat | Font sarasa-mono-sc-semibold.ttf found in local
05-12 22:34:42 [DEBUG] nonebot_plugin_bilichat | Loading font: sarasa-mono-sc-bold.ttf
05-12 22:34:42 [DEBUG] nonebot_plugin_bilichat | Font sarasa-mono-sc-bold.ttf found in local
05-12 22:34:42 [DEBUG] nonebot_plugin_bilichat | Loading font: vanfont.ttf
05-12 22:34:42 [DEBUG] nonebot_plugin_bilichat | Font vanfont.ttf found in local
05-12 22:34:43 [DEBUG] nonebot_plugin_bilichat | Loading font: HarmonyOS_Sans_SC_Medium.ttf
05-12 22:34:43 [DEBUG] nonebot_plugin_bilichat | Font HarmonyOS_Sans_SC_Medium.ttf found in local
05-12 22:34:43 [DEBUG] nonebot_plugin_bilichat | Loading font: nte.ttf
05-12 22:34:43 [DEBUG] nonebot_plugin_bilichat | Font nte.ttf found in local
05-12 22:34:43 [SUCCESS] nonebot_plugin_bilichat | 

获取动态(专栏)解析正常返回,只有汉字无法正常显示,结果同上

05-12 22:35:40 [SUCCESS] nonebot | OneBot V11 3782204632 | [message.private.friend]: Message -2147483036 from 1257269453 'https://b23.tv/tCQrOVJ'
05-12 22:35:40 [DEBUG] nonebot | Checking for matchers in priority 1...
05-12 22:35:40 [DEBUG] nonebot | Checking for matchers in priority 2...
05-12 22:35:40 [DEBUG] nonebot_plugin_bilichat | b23.tv url: https://www.bilibili.com/read/cv34468276/
05-12 22:35:40 [INFO] nonebot_plugin_bilichat | column id: cv34468276
05-12 22:35:41 [DEBUG] nonebot_plugin_bilichat | {'content': 'https://b23.tv/sB5tu73', 'count': 0}
05-12 22:35:41 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_bilichat.base_content_parsing, lineno=152)
05-12 22:35:41 [DEBUG] nonebot | Running Matcher(type='message', module=nonebot_plugin_bilichat.base_content_parsing, lineno=152)
05-12 22:35:41 [DEBUG] nonebot | Running handler Dependent(call=content_info)
05-12 22:35:41 [INFO] nonebot_plugin_bilichat | 正在截图专栏:34468276
05-12 22:35:41 [DEBUG] nonebot_plugin_bilichat | 正在为浏览器添加cookies
05-12 22:35:48 [DEBUG] nonebot | OneBot V11 | Calling API send_msg
05-12 22:35:49 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_bilichat.base_content_parsing, lineno=152) running complete
Well2333 commented 4 months ago

bilichat下载的本地字体仅用于视频详情截图等bilichat内置的SSR页面,以及skia或pillow本地绘图使用,直接对b站页面截图的情况下是无法调用本地字体的。

造成这个问题的原因可能与你所使用的操作系统或playwright版本有关,或因为你的系统里面没有可用的中文字体导致的(常见于 Linux server 类型的发行版)

你可以尝试直接为系统添加字体,或重新安装playwright来解决此问题

Yppup commented 4 months ago

已通过为系统安装中文字体解决,感谢🙏