## 使用 selenium 破解 acw_sc__v3 滑动验证码
import time
import undetected_chromedriver as uc
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
def get_cookie_zfcgs():
str_cookie = ''
for _i in range(3):
chrome_options = uc.ChromeOptions()
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--disable-popup-blocking")
chrome_options.add_argument("--profile-directory=Default")
chrome_options.add_argument("--ignore-certificate-errors")
chrome_options.add_argument("--disable-plugins-discovery")
chrome_options.add_argument("--incognito")
chrome_options.add_argument('--no-first-run')
chrome_options.add_argument('--no-service-autorun')
chrome_options.add_argument('--no-default-browser-check')
chrome_options.add_argument('--password-store=basic')
chrome_options.add_argument('--no-sandbox')
driver = uc.Chrome(chrome_options=chrome_options, version_main=110)
driver.delete_all_cookies()
driver.get(
'https://www.zcygov.cn/eevees/search?fcid=1318612&holdParam=false&utm=luban.luban-PC-194.161-market-menubar-pc.1.b7b6ac80d2b111ed8e039d620b9fbdab')
time.sleep(7)
dragger = driver.find_element(By.ID, 'nc_1_n1z')
action = ActionChains(driver)
action.click_and_hold(dragger).perform()
for index in range(20):
try:
action.move_by_offset(71, 0).perform()
except Exception as e:
pass
content = driver.get_cookies()
print('-------------ppppppp')
driver.close()
driver.quit()
for item in content:
str_cookie += item['name'] + '=' + item['value'] + '; '
if 'acw_sc__v3' in str_cookie:
break
else:
continue
return str_cookie
if __name__ == '__main__':
get_cookie_zfcgs()