寻找回拨 [英] finding recaptcha callback

查看:82
本文介绍了寻找回拨的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图从此页面获取数据

解决方案

当我检查该URL并在屏幕上显示验证码时,则 ___ grecaptcha_cfg.clients [0] 中的对象在哪里回调可用是不同的,即 ___ grecaptcha_cfg.clients [0] 上没有 L ,这就是为什么您可能会得到此错误的原因.因此,请考虑根据类型导航到 callback 对象,而不是直接访问.

  const client = ___ grecaptcha_cfg.clients [0]const键= Object.keys(客户端)const requiredKey = keys.find(key => client [key] .constructor.name ==="VK");const requiredObj = client [requiredKey];const callbackObjKey = Object.keys(requiredObj).find(key => requiredObj [key] .callback);requiredObj [callbackObjKey] .callback("$ {cap}") 

希望这会有所帮助.

我已经修改了代码,并使用下面的方法来找到 callback 对象,尽管该方法并非经过优化,但这是我认为可以找出 callback 方法的方法

  const reduceObjectToArray =(obj)=>Object.keys(obj).reduce(function(r,k){返回r.concat(k,obj [k]);},[]);const client = ___ grecaptcha_cfg.clients [0]令result = [];结果= reduceObjectToArray(client).filter(c => Object.prototype.toString.call(c)==="[object Object]")结果= result.flatMap(r => {返回reduceObjectToArray(r)})结果= result.filter(c => Object.prototype.toString.call(c)==="[object Object]")const reqObj = result.find(r => r.callback)reqObj.callback("$ {cap}") 

im trying to get data from this page

https://ahrefs.com/backlink-checker

its basically a website to check a domain rank and other status , when u enter a domain and click the check Check backlinks button it shows a google recaptcha

im using a captcha service to bypass this , problem is this site uses a callback on the captcha completion , when i recive the token from my api and put it in the #g-recaptcha-response i have to call the callback to move on there is no submit button

i used to find the callback in this object

___grecaptcha_cfg.clients[0].L.L.callback

and just call it like

page.evaluate(`___grecaptcha_cfg.clients[0].L.L.callback("${cap}")`)

but recently this obeject is nowhere to be found

and i get Evaluation failed: TypeError: Cannot read property 'L' of undefined

any idea?

解决方案

When I checked that url and when the captcha was there on the screen, then the object inside ___grecaptcha_cfg.clients[0] where callback was available was different i.e., L was not there on ___grecaptcha_cfg.clients[0], that's why you might have got the error. So thought of navigating to the callback object based on the type rather than directly accessing.

const client = ___grecaptcha_cfg.clients[0]
const keys = Object.keys(client)
const requiredKey = keys.find(key => client[key].constructor.name === "VK");

const requiredObj = client[requiredKey];

const callbackObjKey = Object.keys(requiredObj).find(key => requiredObj[key].callback);
requiredObj[callbackObjKey].callback("${cap}")

Hope this helps.

I have modified the code and used below approach to find the callback object, though this method is not so optimised but this is the way I could think to find out the callback method

const reduceObjectToArray = (obj) => Object.keys(obj).reduce(function (r, k) {
        return r.concat(k, obj[k]);
}, []);

const client = ___grecaptcha_cfg.clients[0]
let result = [];
result = reduceObjectToArray(client).filter(c => Object.prototype.toString.call(c) === "[object Object]")

result = result.flatMap(r => {
    return reduceObjectToArray(r)
})

result = result.filter(c => Object.prototype.toString.call(c) === "[object Object]")

const reqObj = result.find( r => r.callback)
reqObj.callback("${cap}")

这篇关于寻找回拨的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆