学习强国爬虫 搜索+文章内容

This commit is contained in:
2025-11-21 11:49:41 +08:00
parent 97da821799
commit 0e7cee3070
41 changed files with 14904 additions and 79 deletions

View File

@@ -20,7 +20,7 @@ from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.chrome.service import Service
import platform
import time
import random
import os
@@ -126,7 +126,12 @@ class XhwCrawler(BaseCrawler):
chrome_options.add_argument('--disable-web-security')
chrome_options.add_argument('--allow-running-insecure-content')
chrome_options.add_argument('--disable-features=VizDisplayCompositor')
service = Service(executable_path=r"chromedriver.exe")
chrome_driver_path = 'win/chromedriver.exe'
if platform.system() == 'Linux':
chrome_driver_path = 'linux/chromedriver'
service = Service(executable_path=chrome_driver_path)
driver = None
try: