2captcha / 2captcha-ruby

Ruby gem for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.
https://rubygems.org/gems/ruby-2captcha
MIT License
14 stars 2 forks source link

Support Base64 images directly for the image params #20

Open NickNish09 opened 1 month ago

NickNish09 commented 1 month ago

Hi, first of all, great lib! I was just wondering if we can send a Base64 image directly as a param to the methods in the lib. For example for the coordinates method:

Api2Captcha.new(API_KEY).coordinates(
    image: an_image_that_is_base_64_encoded_already, # this seems not to be working since it tries to encode again inside the gem
    lang: 'en',
    hint_text: 'Some text'
)

I'm currently using this with a screenshot that I get from Selenium (image_in_selenium_driver.screenshot_as(:base64)), and that comes already in base64. I'm receiving the ERROR_IMAGE_TYPE_NOT_SUPPORTED error when trying to use this directly. Do you guys see an alternative that I can do here? Besides trying to write a file or using the original source from Selenium (have some other limitations on doing that)