可以参观相关文档:DrissionPage官网
- 准备环境
pip install DrissionPage 目前DrissionPage是直接绕过5秒盾模块(selenium,异步等都需要配置),不需要任何配置可直接绕过当前网站的保护
- 打开开发者
#DrissionPage 可以参观开发文档(url:https://drissionpage.cn/) from DrissionPage import ChromiumPage, ChromiumOptions options = ChromiumOptions().set_load_mode('none') options.set_paths() arguments = ["--auto-open-devtools-for-tabs",# "--headless"] for argument in self.arguments: options.set_argument(argument)
- 启动浏览器
driver=ChromiumPage(options) url = "***********************" while True: try: driver.get(url) # 重试页面5 time.sleep(random.randint(2,5)) result = driver.html html = etree.HTML(result) cf_turnstile_response = html.xpath('//*[@id="turnstile-flight-search"]/input/@value') print(f"cf_turnstile_response:{cf_turnstile_response[0]}") return cf_turnstile_response[0] except Exception as e: continue
- 测试参数
- 总统来说获取一次cf_turnstile_response(跟自己网络配置有关)大概需要个5-7秒左右,比引用第三方还快一点吧,至于打开开发者这一步如有想了解需要花一点时间哦。。。。搞这个真的需要很大耐心,失败一次又得重新
希望多多关注一下下哦,下期如何破解cf_clearance。。。。。
今天的任务就到这里,有不懂可以私,,,,下期:破解cloudflare缓存cookies的cf_clearance
有兴趣可以QQ群讨论:679666897