绕过反爬虫网站检测 Python + selenium 4.0

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium import webdriver
from time import sleep, time

# https://bot.sannysoft.com/ 以下代码通过该网站的反爬虫检测
# 通过反爬虫检测需要重要的文件 stealth.min.js 需要及时更新 
# https://github.com/requireCool/stealth.min.js

option = webdriver.ChromeOptions()
option.add_experimental_option('excludeSwitches', ['enable-automation'])
driver = webdriver.Chrome(options=option)

driver.maximize_window()
with open('./stealth.min.js') as f:
js = f.read()
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
"source": js
})

driver.get("https://bot.sannysoft.com/")
Subscribe