改善反反爬功能

This commit is contained in:
g1879 2021-10-26 15:09:40 +08:00
parent 0ebcebc482
commit f6c0b72f39
2 changed files with 4 additions and 5 deletions

View File

@ -4,16 +4,15 @@
@Contact : g1879@qq.com
@File : drission.py
"""
from sys import exit
from typing import Union
from requests import Session
from requests.cookies import RequestsCookieJar
from selenium import webdriver
from selenium.common.exceptions import SessionNotCreatedException, WebDriverException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.webdriver import WebDriver
from sys import exit
from tldextract import extract
from typing import Union
from .config import (_dict_to_chrome_options, _session_options_to_dict,
SessionOptions, DriverOptions, _chrome_options_to_dict, OptionsManager, _cookies_to_tuple)
@ -109,7 +108,7 @@ class Drission(object):
# 反反爬设置
try:
self._driver.execute_script('Object.defineProperty(navigator,"webdriver",{get:() => Chrome,});')
self._driver.execute_script('Object.defineProperty(navigator,"webdriver",{get:() => undefined,});')
except:
pass

View File

@ -6,7 +6,7 @@ with open("README.md", "r", encoding='utf-8') as fh:
setup(
name="DrissionPage",
version="1.11.3",
version="1.11.4",
author="g1879",
author_email="g1879@qq.com",
description="A module that integrates selenium and requests session, encapsulates common page operations.",