Zaczero / 2Captcha

🍬 Simple API wrapper for https://2captcha.com
MIT License
32 stars 16 forks source link

About Hcaptcha Sitekey #14

Closed xianling88 closed 4 years ago

xianling88 commented 4 years ago

This is maybe not a code problem at all, but allow me to ask this. I am somewhat new to this bypass thing, but I need to crawl some website to collect data for my study purpose automatically done by program, but there is more and more websites using cloudflare protection, sometimes I need to deal with hCaptcha to collect data, but so for no luck, and I found your thing man, this is pretty cool, and I just got one question, how can I find out the so-called site-key to use your code to bypass cloudflare hCaptcha?

Zaczero commented 4 years ago

Hello, hCaptcha sitekey is of the following format: 33f96e6a-38cd-421b-bb68-7806e1764460.

However if you want to access websites behind Cloudflare protection simple GET request will not work as the sitekey is obfuscated inside the JavaScript code. Every captcha challenge contains a small JavaScript challenge as well. Selenium is usually a way to go. After few seconds simply fetch PageSource and you should be able to view the sitekey. After getting hCaptcha response simply inject it into the form and submit it. It's a little tricky but doable! Good luck!

xianling88 commented 4 years ago

Thanks for the help, it pointed me the direction, and I tried to pull some code to use selenium witch you recommended, and also successfully got the pagesource, but there is not any sitekey thing that I can find, is there something that I did wrong? Or the sitekey is encoded from being found?

Zaczero commented 4 years ago

Thanks for the help, it pointed me the direction, and I tried to pull some code to use selenium witch you recommended, and also successfully got the pagesource, but there is not any sitekey thing that I can find, is there something that I did wrong? Or the sitekey is encoded from being found?

After successfully loading a web page make 3-4 second sleep, then fetch page source.