Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
445 views
in Technique[技术] by (71.8m points)

javascript - 使用p操纵器通过无头Chrome绕过验证码(Bypassing CAPTCHAs with Headless Chrome using puppeteer)

google finds my browser is being manipulated/controlled/automated by software, and because of that I get captchas .(google发现我的浏览器正在由软件manipulated/controlled/automated ,因此我得到了captchas 。)

I start chromium manually and do the same steps the captchas doesn't appear.(我手动启动铬,并执行与验证码相同的步骤。) Question 1) Is it possible to solve captcha Programmatically or get rid of it when using puppeteer ?(使用puppeteer时是否可以通过编程方式解决验证码或摆脱验证码?) Any way to solve this?(有什么办法解决这个问题?) Question 2) Does this happens only when without headless option ie(仅在没有headless选项的情况下才会发生这种情况, ie) const browser = await puppeteer.launch({ headless: false }) OR this is something the fact we have to accept and move on?(还是这是我们必须接受并继续前进的事实?)   ask by rinold simon translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try generating random useragent using this npm package .(尝试使用此npm软件包生成随机useragent。)

This usually solves the user agent-based protection.(这通常可以解决基于用户代理的保护。) In puppeteer pages can override browser user agent with page.setUserAgent(在page.setUserAgent页面中,可以使用page.setUserAgent覆盖浏览器用户代理。) var userAgent = require('user-agents'); ... await page.setUserAgent(userAgent.toString()) Additionally, you can add these two extra plugins,(此外,您可以添加这两个额外的插件,) puppeteer-extra-plugin-recaptcha - Solves reCAPTCHAs automatically, using a single line of code: page.solveRecaptchas()(puppeteer-extra-plugin-recaptcha-使用单行代码自动解决reCAPTCHA: page.solveRecaptchas()) puppeteer-extra-plugin-stealth - Applies various evasion techniques to make detection of headless puppeteer harder.(puppeteer-extra-plugin-stealth-应用各种逃避技术,使对无头木偶的检测更加困难。)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...