From 3fcc2d3a36c93d11c5cbc3bbe63c69e90add536c Mon Sep 17 00:00:00 2001 From: mshe <666666666@666666666.666666666> Date: Wed, 27 May 2026 15:41:50 +0800 Subject: [PATCH] =?UTF-8?q?debug(spider):=20=E4=BF=AE=E6=94=B9=E7=88=AC?= =?UTF-8?q?=E8=99=AB=E8=B0=83=E8=AF=95=E9=85=8D=E7=BD=AE=E5=B9=B6=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=AE=89=E8=A3=85=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将浏览器启动模式从无头模式改为有头模式以便调试 - 在预安装脚本中添加虚拟环境激活命令 - 重新排列安装脚本中的依赖安装顺序 --- pre_install.sh | 3 ++- spider/china_net.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pre_install.sh b/pre_install.sh index f134876..d346ef7 100755 --- a/pre_install.sh +++ b/pre_install.sh @@ -1,5 +1,6 @@ apt install -y python3.12-dev python3.12-venv python3 -m venv .venv --system-site-packages +source .venv/bin/activate .venv/bin/python3.12 -m pip install -r requirements.txt playwright install -playwright install-deps +playwright install-deps \ No newline at end of file diff --git a/spider/china_net.py b/spider/china_net.py index 3ffc08b..6131181 100644 --- a/spider/china_net.py +++ b/spider/china_net.py @@ -4,7 +4,7 @@ from bs4 import BeautifulSoup def crawl_vue_app(): with sync_playwright() as p: # 启动浏览器(headless=False 可以看到浏览器窗口) - browser = p.chromium.launch(headless=True) + browser = p.chromium.launch(headless=False) page = browser.new_page() # 访问页面 page.goto('https://caigou.chinatelecom.com.cn/')