botcity-dev / botcity-plugins-python

BotCity's Plugins for Python
https://botcity-dev.github.io/botcity-plugins-python/
0 stars 1 forks source link

use of botcity-captcha-plugin #1

Closed Regortech closed 2 years ago

Regortech commented 2 years ago

I need to pass a captcha in internet explorer.

I want to use botcity-captcha-plugin 0.1.2 can you share a sample code? In the examples I saw a code like BotAntiCaptchaPlugin(os.getenv("ANTICAPTCHA_KEY")) . What is ANTIAPTCHA_KEY? can you explain this

hhslepicka commented 2 years ago

@Regortech I moved your issue to the proper repository here. @Psycho-Ray will help you with the usage of the plugin.

Psycho-Ray commented 2 years ago

Hello, @Regortech

BotCity's AntiCaptcha Plugin helps you solve captchas using either AntiCaptcha or Death By Captcha, which are captcha solving services.

  1. You can choose which one you prefer and create an account. It's a paid service, but it usually costs only 1-2 dollars per thousand captchas solved. From your account settings, you will obtain your ANTICAPTCHA_KEY (if you prefer AntiCaptcha) or you DBC_USERNAME and DBC_PASSWORD (if you prefer Death By Captcha).

  2. After that, you can use the plugin as demonstrated on the documentation here: https://botcity-dev.github.io/botcity-plugins-python/botcity-captcha-plugin-python/intro/

  3. Keep in mind that different types of captcha exists:

  4. The image captcha, the one you have to type the letters you see, is the easiest one to deal with, just provide the captcha image to plugin.solve_text() method, which will extract the text for you, then paste it in right field on the website.

  5. ReCaptcha, on the other hand, can be tricky. You'll need URL of the page you're accessing, and also the captcha_id. You can usually get it by inspecting the page and finding the captcha element. Then, you need to inject the captcha response back into the website. The easiest way to do both things is using BotCity's WebBot to manipulate the page elements. You can see how it's done in this example on our Bot Repository: Bot ReCaptcha.

Here is a sneak peak from it's source code:

captcha_id = self.find_element('.g-recaptcha').get_attribute('data-sitekey')
response = anti_captcha.solve_re("https://www.google.com/recaptcha/api2/demo", captcha_id)
self.execute_javascript('document.getElementById("g-recaptcha-response").innerHTML = "%s"' % response)
hhslepicka commented 2 years ago

Closing this issue. @Regortech feel free to reopen it if you have further questions.