mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
Update browser.py
This commit is contained in:
parent
2a6951426b
commit
558c836fe4
@ -21,7 +21,7 @@ async def init(**kwargs) -> Optional[Browser]:
|
|||||||
browser = await async_playwright().start()
|
browser = await async_playwright().start()
|
||||||
_browser = await browser.chromium.launch(**kwargs)
|
_browser = await browser.chromium.launch(**kwargs)
|
||||||
return _browser
|
return _browser
|
||||||
except NotImplemented:
|
except NotImplementedError:
|
||||||
logger.warning('win环境下 初始化playwright失败....请替换环境至linux')
|
logger.warning('win环境下 初始化playwright失败....请替换环境至linux')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -47,13 +47,7 @@ def delete_pyppeteer():
|
|||||||
dir = Path(AppDirs('pyppeteer').user_data_dir)
|
dir = Path(AppDirs('pyppeteer').user_data_dir)
|
||||||
if not dir.exists():
|
if not dir.exists():
|
||||||
return
|
return
|
||||||
|
|
||||||
# if not config.haruka_delete_pyppeteer:
|
|
||||||
# logger.info("检测到 Pyppeteer 依赖(约 300 M),"
|
|
||||||
# "新版 HarukaBot 已经不需要这些文件了。"
|
|
||||||
# "如果没有其他程序依赖 Pyppeteer,请在 '.env.*' 中设置"
|
|
||||||
# " 'HARUKA_DELETE_PYPPETEER=True' 并重启 Bot 后,将自动清除残留")
|
|
||||||
# else:
|
|
||||||
shutil.rmtree(dir)
|
shutil.rmtree(dir)
|
||||||
logger.info("已清理 Pyppeteer 依赖残留")
|
logger.info("已清理 Pyppeteer 依赖残留")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user