mirror of
https://github.com/FlareSolverr/FlareSolverr.git
synced 2025-06-08 12:35:30 +00:00
Simplify 'Verify you are human' resolver. Related #811
This commit is contained in:
parent
7728f2ab31
commit
f7e434c6e3
11
src/utils.py
11
src/utils.py
@ -62,7 +62,6 @@ def get_webdriver(proxy: dict = None) -> WebDriver:
|
|||||||
# workaround for updated 'verify your are human' check
|
# workaround for updated 'verify your are human' check
|
||||||
# https://github.com/FlareSolverr/FlareSolverr/issues/811
|
# https://github.com/FlareSolverr/FlareSolverr/issues/811
|
||||||
options.add_argument('--auto-open-devtools-for-tabs')
|
options.add_argument('--auto-open-devtools-for-tabs')
|
||||||
options.add_argument('--headless=true')
|
|
||||||
|
|
||||||
if proxy and 'url' in proxy:
|
if proxy and 'url' in proxy:
|
||||||
proxy_url = proxy['url']
|
proxy_url = proxy['url']
|
||||||
@ -96,20 +95,14 @@ def get_webdriver(proxy: dict = None) -> WebDriver:
|
|||||||
# if we don't set driver_executable_path it downloads, patches, and deletes the driver each time
|
# if we don't set driver_executable_path it downloads, patches, and deletes the driver each time
|
||||||
driver = uc.Chrome(options=options, browser_executable_path=browser_executable_path,
|
driver = uc.Chrome(options=options, browser_executable_path=browser_executable_path,
|
||||||
driver_executable_path=driver_exe_path, version_main=version_main,
|
driver_executable_path=driver_exe_path, version_main=version_main,
|
||||||
windows_headless=windows_headless)
|
windows_headless=windows_headless, headless=windows_headless)
|
||||||
|
|
||||||
# save the patched driver to avoid re-downloads
|
# save the patched driver to avoid re-downloads
|
||||||
if driver_exe_path is None:
|
if driver_exe_path is None:
|
||||||
PATCHED_DRIVER_PATH = os.path.join(driver.patcher.data_path, driver.patcher.exe_name)
|
PATCHED_DRIVER_PATH = os.path.join(driver.patcher.data_path, driver.patcher.exe_name)
|
||||||
|
if PATCHED_DRIVER_PATH != driver.patcher.executable_path:
|
||||||
shutil.copy(driver.patcher.executable_path, PATCHED_DRIVER_PATH)
|
shutil.copy(driver.patcher.executable_path, PATCHED_DRIVER_PATH)
|
||||||
|
|
||||||
# workaround for updated 'verify your are human' check
|
|
||||||
# https://github.com/FlareSolverr/FlareSolverr/issues/811
|
|
||||||
driver.execute_script('''window.open("","_blank");''')
|
|
||||||
driver.switch_to.window(window_name=driver.window_handles[0])
|
|
||||||
driver.close()
|
|
||||||
driver.switch_to.window(window_name=driver.window_handles[0])
|
|
||||||
|
|
||||||
# selenium vanilla
|
# selenium vanilla
|
||||||
# options = webdriver.ChromeOptions()
|
# options = webdriver.ChromeOptions()
|
||||||
# options.add_argument('--no-sandbox')
|
# options.add_argument('--no-sandbox')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user