go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5.22k stars 343 forks source link

rod 控制浏览器访问使用geo.captcha-delivery.com验证的网站会出现被封锁了。 #1109

Open wuchuwei opened 2 weeks ago

wuchuwei commented 2 weeks ago

Rod Version: v0.116.2

The code to demonstrate your question

我使用rod配置代理浏览etsy.com出现拖动验证码。验证通过后马上被封锁。 I'm sorry, I don't understand English. I use translation software to translate Chinese into English so that more people can see the Tao. I use rod configuration agent to browse etsy.com and drag the CAPTCHA. They're blocked as soon as they pass the verification.

func main() {
   var data_dir string =""
   var proxy string = "xxxxx"
    browserPath, _ := launcher.LookPath()
    log.Println("chrome浏览器位置:",browserPath)

    // 使用获取到的路径启动浏览器
    l, err := launcher.New().Bin(browserPath).Logger(os.Stdout).Set("disable-blink-features", "AutomationControlled").Set("disable-default-apps").Set("no-first-run").UserDataDir(data_dir).Headless(false).Devtools(false).Proxy(proxy).Launch()
    if err !=nil { 
        log.Println("err:",err)
    time.Sleep(5 * time.Second)
    }else{
    log.Println("controlURL:",l)
    browser := rod.New().ControlURL(l).MustConnect().NoDefaultDevice()
    defer browser.MustClose()
    go browser.MustHandleAuth("xxx", "xxx")()
    time.Sleep(2 * time.Second)
    page :=stealth.MustPage(browser)
    page.MustNavigate("https://www.etsy.com")
    page.MustWaitLoad()

    go browser.EachEvent(func(e *proto.TargetTargetCreated){
        if e.TargetInfo.Type != proto.TargetTargetInfoTypePage{
            return
        }
        newpage :=browser.MustPageFromTargetID(e.TargetInfo.TargetID)
        _,err :=newpage.EvalOnNewDocument(stealth.JS)
       if err != nil { log.Println(err)}
       log.Println("打开新的标签:",newpage.MustInfo().Title)
         return
       })()
    log.Println("Page Title:", page.MustInfo().Title)
    select {
    }
     }
}

What you got

通过验证码验证后被网站封禁。 The site was banned after passing the verification code.

What you expect to see

希望通过验证后能正常访问网站 I hope that after passing the verification, I can access the website normally

What have you tried to solve the question

我做过下面几项测试。 1.我提取了chrome://version中的参数。通过命令行启动浏览器遇到验证码验证 后可以正常访问网站,如果验证过程是打开devtools的就会被封锁。 2提取正常访问的etsy网站的cookie注入gost打开的浏览器也能正常访问网站。 3指定remote-debugging-port端口后在另一个chrome实例上通过chrome://inspect/#devices的远程调试功能连接浏览器验证通过也可以正常访问网站。 4.我试着stealth避开网站的自动化检查。

  1. I extracted the parameters in chrome://version. After the browser is started through the command line, it can normally access the website after encountering the verification code. If the verification process is to open devtools, it will be blocked. 2 Extract the cookies of the normally visited etsy website and inject the browser opened by gost to access the website normally. 3 Specify the remote-debugging-port port and use the remote debugging function of chrome://inspect/#devices on another chrome instance to connect to the browser.
  2. I tried stealth to avoid the site's automated checks.
github-actions[bot] commented 2 weeks ago

Please fix the format of your markdown:

3 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## The code to demonstrate your question"]
6 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```go"]
49 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Above] [Context: "## What you expect to see"]
53 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Above] [Context: "## What have you tried to solve the question"]
54 MD003/heading-style/header-style Heading style [Expected: atx; Actual: setext]
54 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Above] [Context: "我做过下面几项测试。"]
54:10 MD026/no-trailing-punctuation Trailing punctuation in heading [Punctuation: '。']
60 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "1. I extracted the parameters ..."]
63:1 MD029/ol-prefix Ordered list item prefix [Expected: 2; Actual: 4; Style: 1/2/3]

generated by check-issue