在不使用selenium的情况下,如何仅使用python请求绕过reCAPTCHA v2?

2024-04-19 21:20:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图使一个网站的机器人帐户生成器。但是,我很难通过验证码。我看到过多个脚本可以下载音频文件,并使用谷歌语音识别api和selenium模块完成验证码,比如我的一个朋友创建的这个脚本:https://github.com/Sadtrxsh/recaptcha-v2-bypass。如果您还不知道captcha有一个音频选项,它会播放音频录音,您可以键入听到的单词。然而,我试图将其简化为http请求,以便使此过程更加高效。当我尝试执行下面的代码时,部分输出显示b'{"captcha_key": ["captcha-required"]}'<bound method Response.json of <Response [400]>>

我不知道这个“密钥”是如何工作的,也不知道如何只使用http请求来完成验证码并修复错误

response = requests.post(
    url,
    json={"email":str(random_digits_generator(10))+"@example.domain","username":random_digits_generator(15)),"password":"roblox69420!"},
    headers={"User_Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11",'Content-Type': 'application/json','referer':'https://www.google.com/'},
    proxies={'http': proxy})

if response.status_code == 200:
    print('Account created successfully')
    print(response.content)
    print(response.headers)
    print(response.json())
else:
    print("Failed to create account")
    print(response.headers)
    print(response.content)
    print(response.json())

Tags: https脚本comjsonhttpresponserandom音频