欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

python过【安全检查!|百度云加速】的解决方案

时间:2023-05-23

首先假设我们还不知道网站有百度云加速检查,先直接获取。网址因某些原因屏蔽,但是不影响整体思路

shareurl='https:**************************'headers={'user-agent':'Mozilla/5.0(WindowsNT10.0;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/69.0.3497.100Safari/537.36',}response=httpx.get(shareurl,headers=headers)cookie=response.headers['set-cookie'].split(';')[0]ray=response.headers['cf-ray'].split('-')[0]posturl='/'.join(shareurl.split('/')[:3])+html.unescape(re.findall('(?<=action=").+?(?=")',response.text)[0])r=re.findall('(?<=value=").+?(?=")',response.text)[0]url='https://captcha.su.baidu.com/session_cb?pub=377e4907e1a3b419708dbd00df9e8f79'headers={'Host':'captcha.su.baidu.com','Referer':shareurl,'User-Agent':'Mozilla/5.0(WindowsNT10.0;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/69.0.3497.100Safari/537.36'}response=httpx.get(url,headers=headers).textsession=response.split('"')[-2]url='https://captcha.su.baidu.com/image?session='+session+'&pub=377e4907e1a3b419708dbd00df9e8f79'response=httpx.get(url,headers=headers).contentwithopen('验证码.jpg','wb')asf:f.write(response)yanzhengma=input('请输入同目录下的验证码:')headers={'content-type':'application/x-www-form-urlencoded','cookie':cookie,'referer':shareurl,'user-agent':'Mozilla/5.0(WindowsNT10.0;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/69.0.3497.100Safari/537.36',}data={'r':r,'id':ray,'captcha_challenge_field':session,'manual_captcha_challenge_field':yanzhengma,}response=httpx.post(posturl,headers=headers,data=data)print(response.text)


Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。