mirror of
https://github.com/Nezumi-2711/astrbot_plugin_qq_group_daily_analysis.git
synced 2026-09-22 13:38:43 +00:00
[debug] 调试 pyppeteer 启动 chromium
This commit is contained in:
+26
-1
@@ -89,9 +89,34 @@ class PDFInstaller:
|
|||||||
|
|
||||||
# 尝试启动浏览器,这会触发自动下载
|
# 尝试启动浏览器,这会触发自动下载
|
||||||
logger.info("启动 pyppeteer 浏览器以触发 Chromium 自动下载...")
|
logger.info("启动 pyppeteer 浏览器以触发 Chromium 自动下载...")
|
||||||
|
|
||||||
|
# 根据操作系统设置不同的参数
|
||||||
|
import platform
|
||||||
|
system = platform.system().lower()
|
||||||
|
|
||||||
|
if system == "linux":
|
||||||
|
# Linux 环境下需要更多参数来避免权限问题
|
||||||
|
browser_args = [
|
||||||
|
'--no-sandbox',
|
||||||
|
'--disable-setuid-sandbox',
|
||||||
|
'--disable-dev-shm-usage',
|
||||||
|
'--disable-accelerated-2d-canvas',
|
||||||
|
'--no-first-run',
|
||||||
|
'--no-zygote',
|
||||||
|
'--single-process',
|
||||||
|
'--disable-gpu'
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
# Windows/macOS 环境下的标准参数
|
||||||
|
browser_args = [
|
||||||
|
'--no-sandbox',
|
||||||
|
'--disable-setuid-sandbox',
|
||||||
|
'--disable-gpu'
|
||||||
|
]
|
||||||
|
|
||||||
browser = await launch(
|
browser = await launch(
|
||||||
headless=True,
|
headless=True,
|
||||||
args=['--no-sandbox', '--disable-setuid-sandbox']
|
args=browser_args
|
||||||
)
|
)
|
||||||
|
|
||||||
# 获取 Chromium 路径
|
# 获取 Chromium 路径
|
||||||
|
|||||||
Reference in New Issue
Block a user