如何将g-recaptcha-response发送到网页?

时间:2019-05-21 12:31:00

标签: python recaptcha invisible-recaptcha grecaptcha

我正在开发一个Python脚本,用于执行网页的网页抓取。 我必须通过reCaptcha表单才能访问该页面,因此我决定使用第三方软件来自动解决验证码。该软件获取页面的链接,解决验证码并返回响应(g-recaptcha-response),我必须在GET / POST请求中将其发送到页面。

问题是页面没有显示内容,而是返回错误消息。 这是获取响应的页面的Java代码:

<script>
var pickValidationRecaptcha;
function pickValidateRecaptchaCallback() {
    pickValidationRecaptcha = grecaptcha.render('pickValidationRecaptcha', {
        'sitekey': recaptchaKey,
        'callback': function (resp) {
            $.ajax({
                type: "get",
                url: "/pick/7a7a5a9387966a6f57e85db7294ddfbf?g-recaptcha-response=" + resp
            }).done(function (html) {
                $("body").html(html);
            });

        },
        'expired-callback': function () {
            try {
                grecaptcha.reset(reportRecaptcha);
            }
            catch (e) {
            }
        }
    });
}
$(document).ready(function () {
    setTimeout(function () {
        if ($("#pickValidationRecaptcha").length > 0) {
            pickValidateRecaptchaCallback();
        }
    }, 1000);
});
$(document).ajaxComplete(function () {
    setTimeout(function () {
        if ($("#pickValidationRecaptcha").length > 0) {
            pickValidateRecaptchaCallback();
        }
    }, 1000);
});
</script>

我向页面发送POST请求,并且有效负载中有g-recaptcha-response:

payload = {'g-recaptcha-response': resp}
r = Session.post(url, data=payload)

我尝试发送GET请求,但不起作用(使用reCaptcha重新加载同一页面

0 个答案:

没有答案
相关问题