调整chrome内容

This commit is contained in:
liuwei
2025-05-06 17:06:47 +08:00
parent bb7560d390
commit d2fbfdfde9

View File

@@ -82,6 +82,11 @@ def fetch_images(post_url):
print(f"帖子 {post_url} 共有 {total_pages}")
options = Options()
options.add_argument('--headless') # 使用新的headless模式
options.add_argument('--disable-gpu')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage') # 添加Linux特定配置
options.headless = True
# 根据操作系统选择不同的ChromeDriver路径处理方式
if os.name == 'nt': # Windows