anti_captcha 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +5 -37
 - data/lib/anti_captcha/client.rb +8 -49
 - data/lib/anti_captcha/version.rb +1 -1
 - metadata +3 -4
 - data/lib/anti_captcha/models/h_captcha_solution.rb +0 -16
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 4db85d1586244634fe6f124e9574e93678a2a59138c1ee78c780b61aa699619e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: bdf1e212aa6efdfa2243589d07114050b5796d39c5ecdf16ab7a2cc485ef2124
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f1165c9a41a66603e82a698100564c8ed419111d54b73ae909f3ab56a3720046c8487c614147d7570f57211dc0fc979b117fb08407d9333f85add93ebde2da91
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: cfa3add2a4cbd04040a74f491eb173fce9da94f47111c9a1a301c176872f18b216cfbef03ab0158c0caae29d67695b89bd8b0511681c58203103066960213634
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -119,40 +119,6 @@ solution.g_recaptcha_response 
     | 
|
| 
       119 
119 
     | 
    
         
             
            > About the `min_score` parameter: it's strongly recommended to use a minimum score of `0.3` as higher
         
     | 
| 
       120 
120 
     | 
    
         
             
            > scores are rare.
         
     | 
| 
       121 
121 
     | 
    
         | 
| 
       122 
     | 
    
         
            -
            #### hCaptcha
         
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
            ```ruby
         
     | 
| 
       125 
     | 
    
         
            -
            solution = client.decode_h_captcha!(
         
     | 
| 
       126 
     | 
    
         
            -
              website_key:    'xyz',
         
     | 
| 
       127 
     | 
    
         
            -
              website_url:    'http://example.com/example=1',
         
     | 
| 
       128 
     | 
    
         
            -
              # proxy_type:     'http',                   # OPTIONAL
         
     | 
| 
       129 
     | 
    
         
            -
              # proxy_address:  '127.0.0.1',              # OPTIONAL
         
     | 
| 
       130 
     | 
    
         
            -
              # proxy_port:     '8080',                   # OPTIONAL
         
     | 
| 
       131 
     | 
    
         
            -
              # proxy_login:    'proxyLoginHere',         # OPTIONAL
         
     | 
| 
       132 
     | 
    
         
            -
              # proxy_password: 'proxyPasswordHere',      # OPTIONAL
         
     | 
| 
       133 
     | 
    
         
            -
              # user_agent:     'MODERN_USER_AGENT_HERE', # OPTIONAL
         
     | 
| 
       134 
     | 
    
         
            -
            )
         
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
            solution.token
         
     | 
| 
       137 
     | 
    
         
            -
            "P0_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXNza2V5IjoiNnpWV..."
         
     | 
| 
       138 
     | 
    
         
            -
             
     | 
| 
       139 
     | 
    
         
            -
            # Or
         
     | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
       141 
     | 
    
         
            -
            solution.g_recaptcha_response # Deprecated
         
     | 
| 
       142 
     | 
    
         
            -
            "P0_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXNza2V5IjoiNnpWV..."
         
     | 
| 
       143 
     | 
    
         
            -
            ```
         
     | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
       145 
     | 
    
         
            -
            *Parameters:*
         
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
       147 
     | 
    
         
            -
            - `website_key`: the site key for the hCatpcha.
         
     | 
| 
       148 
     | 
    
         
            -
            - `website_url`: the URL of the page with the hCaptcha challenge.
         
     | 
| 
       149 
     | 
    
         
            -
            - `proxy_type`: optional parameter. Proxy connection protocol.
         
     | 
| 
       150 
     | 
    
         
            -
            - `proxy_address`: optional parameter. The proxy address.
         
     | 
| 
       151 
     | 
    
         
            -
            - `proxy_port`: optional parameter. The proxy port.
         
     | 
| 
       152 
     | 
    
         
            -
            - `proxy_login`: optional parameter. The proxy login.
         
     | 
| 
       153 
     | 
    
         
            -
            - `proxy_password`: optional parameter. The proxy password.
         
     | 
| 
       154 
     | 
    
         
            -
            - `user_agent`: optional parameter. The user agent.
         
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
       156 
122 
     | 
    
         
             
            #### FunCaptcha
         
     | 
| 
       157 
123 
     | 
    
         | 
| 
       158 
124 
     | 
    
         
             
            ```ruby
         
     | 
| 
         @@ -174,7 +140,7 @@ solution.token 
     | 
|
| 
       174 
140 
     | 
    
         
             
            *Parameters:*
         
     | 
| 
       175 
141 
     | 
    
         | 
| 
       176 
142 
     | 
    
         
             
            - `website_key`: the site key for the hCatpcha.
         
     | 
| 
       177 
     | 
    
         
            -
            - `website_url`: the URL of the page with the  
     | 
| 
      
 143 
     | 
    
         
            +
            - `website_url`: the URL of the page with the challenge.
         
     | 
| 
       178 
144 
     | 
    
         
             
            - `proxy_type`: optional parameter. Proxy connection protocol.
         
     | 
| 
       179 
145 
     | 
    
         
             
            - `proxy_address`: optional parameter. The proxy address.
         
     | 
| 
       180 
146 
     | 
    
         
             
            - `proxy_port`: optional parameter. The proxy port.
         
     | 
| 
         @@ -245,6 +211,8 @@ solution.v4['captcha_output'] 
     | 
|
| 
       245 
211 
     | 
    
         
             
            solution = client.decode_turnstile!(
         
     | 
| 
       246 
212 
     | 
    
         
             
              website_key:    'xyz',
         
     | 
| 
       247 
213 
     | 
    
         
             
              website_url:    'http://example.com/example=1',
         
     | 
| 
      
 214 
     | 
    
         
            +
              # action:         'contact_form',           # OPTIONAL
         
     | 
| 
      
 215 
     | 
    
         
            +
              # cdata:          'xyz',                    # OPTIONAL
         
     | 
| 
       248 
216 
     | 
    
         
             
              # proxy_type:     'http',                   # OPTIONAL
         
     | 
| 
       249 
217 
     | 
    
         
             
              # proxy_address:  '127.0.0.1',              # OPTIONAL
         
     | 
| 
       250 
218 
     | 
    
         
             
              # proxy_port:     '8080',                   # OPTIONAL
         
     | 
| 
         @@ -260,6 +228,8 @@ solution.token 
     | 
|
| 
       260 
228 
     | 
    
         | 
| 
       261 
229 
     | 
    
         
             
            - `website_key`: the site key for the Turnstile.
         
     | 
| 
       262 
230 
     | 
    
         
             
            - `website_url`: the URL of the page with the Turnstile challenge.
         
     | 
| 
      
 231 
     | 
    
         
            +
            - `action`: optional parameter. Turnstile challenge unique action.
         
     | 
| 
      
 232 
     | 
    
         
            +
            - `cdata`: optional parameter. Turnstile challenge cData token.
         
     | 
| 
       263 
233 
     | 
    
         
             
            - `proxy_type`: optional parameter. Proxy connection protocol.
         
     | 
| 
       264 
234 
     | 
    
         
             
            - `proxy_address`: optional parameter. The proxy address.
         
     | 
| 
       265 
235 
     | 
    
         
             
            - `proxy_port`: optional parameter. The proxy port.
         
     | 
| 
         @@ -295,8 +265,6 @@ Queue IDs: 
     | 
|
| 
       295 
265 
     | 
    
         
             
            - `18` Recaptcha V3 s0.3
         
     | 
| 
       296 
266 
     | 
    
         
             
            - `19` Recaptcha V3 s0.7
         
     | 
| 
       297 
267 
     | 
    
         
             
            - `20` Recaptcha V3 s0.9
         
     | 
| 
       298 
     | 
    
         
            -
            - `21` hCaptcha with proxy
         
     | 
| 
       299 
     | 
    
         
            -
            - `22` hCaptcha without proxy
         
     | 
| 
       300 
268 
     | 
    
         
             
            - `23` Recaptcha Enterprise V2 with proxy
         
     | 
| 
       301 
269 
     | 
    
         
             
            - `24` Recaptcha Enterprise V2 without proxy
         
     | 
| 
       302 
270 
     | 
    
         
             
            - `25` AntiGateTask
         
     | 
    
        data/lib/anti_captcha/client.rb
    CHANGED
    
    | 
         @@ -4,7 +4,7 @@ module AntiCaptcha 
     | 
|
| 
       4 
4 
     | 
    
         
             
              #
         
     | 
| 
       5 
5 
     | 
    
         
             
              class Client
         
     | 
| 
       6 
6 
     | 
    
         
             
                BASE_URL = 'https://api.anti-captcha.com/:action'
         
     | 
| 
       7 
     | 
    
         
            -
                PROXYABLE_TASKS = %w(RecaptchaV2Task FunCaptchaTask  
     | 
| 
      
 7 
     | 
    
         
            +
                PROXYABLE_TASKS = %w(RecaptchaV2Task FunCaptchaTask GeeTestTask TurnstileTask)
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                attr_accessor :client_key, :timeout, :polling
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
         @@ -169,42 +169,6 @@ module AntiCaptcha 
     | 
|
| 
       169 
169 
     | 
    
         
             
                  AntiCaptcha::FunCaptchaSolution.new(task_result)
         
     | 
| 
       170 
170 
     | 
    
         
             
                end
         
     | 
| 
       171 
171 
     | 
    
         | 
| 
       172 
     | 
    
         
            -
                #
         
     | 
| 
       173 
     | 
    
         
            -
                # Decodes a HCaptcha CAPTCHA.
         
     | 
| 
       174 
     | 
    
         
            -
                #
         
     | 
| 
       175 
     | 
    
         
            -
                # @see `AntiCaptcha::Client#decode_h_captcha!`
         
     | 
| 
       176 
     | 
    
         
            -
                #
         
     | 
| 
       177 
     | 
    
         
            -
                def decode_h_captcha(options, proxy = nil)
         
     | 
| 
       178 
     | 
    
         
            -
                  decode_h_captcha!(options, proxy)
         
     | 
| 
       179 
     | 
    
         
            -
                rescue
         
     | 
| 
       180 
     | 
    
         
            -
                  AntiCaptcha::HCaptchaSolution.new
         
     | 
| 
       181 
     | 
    
         
            -
                end
         
     | 
| 
       182 
     | 
    
         
            -
             
     | 
| 
       183 
     | 
    
         
            -
                #
         
     | 
| 
       184 
     | 
    
         
            -
                # Decodes a HCaptcha CAPTCHA.
         
     | 
| 
       185 
     | 
    
         
            -
                #
         
     | 
| 
       186 
     | 
    
         
            -
                # @param [Hash] options Options hash.
         
     | 
| 
       187 
     | 
    
         
            -
                #   @option options [String]  :website_url
         
     | 
| 
       188 
     | 
    
         
            -
                #   @option options [String]  :website_key
         
     | 
| 
       189 
     | 
    
         
            -
                #
         
     | 
| 
       190 
     | 
    
         
            -
                # @param [Hash] proxy Not mandatory. A hash with configs of the proxy that
         
     | 
| 
       191 
     | 
    
         
            -
                #                     has to be used. Defaults to `nil`.
         
     | 
| 
       192 
     | 
    
         
            -
                #   @option proxy [String]  :proxy_type
         
     | 
| 
       193 
     | 
    
         
            -
                #   @option proxy [String]  :proxy_address
         
     | 
| 
       194 
     | 
    
         
            -
                #   @option proxy [String]  :proxy_port
         
     | 
| 
       195 
     | 
    
         
            -
                #   @option proxy [String]  :proxy_login
         
     | 
| 
       196 
     | 
    
         
            -
                #   @option proxy [String]  :proxy_login
         
     | 
| 
       197 
     | 
    
         
            -
                #   @option proxy [String]  :proxy_password
         
     | 
| 
       198 
     | 
    
         
            -
                #   @option proxy [String]  :user_agent
         
     | 
| 
       199 
     | 
    
         
            -
                #
         
     | 
| 
       200 
     | 
    
         
            -
                # @return [AntiCaptcha::HCaptchaSolution] The solution of the HCaptcha.
         
     | 
| 
       201 
     | 
    
         
            -
                #
         
     | 
| 
       202 
     | 
    
         
            -
                def decode_h_captcha!(options, proxy = nil)
         
     | 
| 
       203 
     | 
    
         
            -
                  task = create_task!('HCaptchaTask', options, proxy)
         
     | 
| 
       204 
     | 
    
         
            -
                  task_result = get_task_result!(task['taskId'])
         
     | 
| 
       205 
     | 
    
         
            -
                  AntiCaptcha::HCaptchaSolution.new(task_result)
         
     | 
| 
       206 
     | 
    
         
            -
                end
         
     | 
| 
       207 
     | 
    
         
            -
             
     | 
| 
       208 
172 
     | 
    
         
             
                #
         
     | 
| 
       209 
173 
     | 
    
         
             
                # Decodes a Geetest CAPTCHA.
         
     | 
| 
       210 
174 
     | 
    
         
             
                #
         
     | 
| 
         @@ -263,6 +227,8 @@ module AntiCaptcha 
     | 
|
| 
       263 
227 
     | 
    
         
             
                # @param [Hash] options Options hash.
         
     | 
| 
       264 
228 
     | 
    
         
             
                #   @option options [String]  :website_url
         
     | 
| 
       265 
229 
     | 
    
         
             
                #   @option options [String]  :website_key
         
     | 
| 
      
 230 
     | 
    
         
            +
                #   @option options [String]  :action
         
     | 
| 
      
 231 
     | 
    
         
            +
                #   @option options [String]  :cdata
         
     | 
| 
       266 
232 
     | 
    
         
             
                #
         
     | 
| 
       267 
233 
     | 
    
         
             
                # @param [Hash] proxy Not mandatory. A hash with configs of the proxy that
         
     | 
| 
       268 
234 
     | 
    
         
             
                #                     has to be used. Defaults to `nil`.
         
     | 
| 
         @@ -364,13 +330,6 @@ module AntiCaptcha 
     | 
|
| 
       364 
330 
     | 
    
         
             
                      websitePublicKey: options[:website_public_key],
         
     | 
| 
       365 
331 
     | 
    
         
             
                    }
         
     | 
| 
       366 
332 
     | 
    
         | 
| 
       367 
     | 
    
         
            -
                  when 'HCaptchaTask'
         
     | 
| 
       368 
     | 
    
         
            -
                    args[:task] = {
         
     | 
| 
       369 
     | 
    
         
            -
                      type:       'HCaptchaTask',
         
     | 
| 
       370 
     | 
    
         
            -
                      websiteURL: options[:website_url],
         
     | 
| 
       371 
     | 
    
         
            -
                      websiteKey: options[:website_key],
         
     | 
| 
       372 
     | 
    
         
            -
                    }
         
     | 
| 
       373 
     | 
    
         
            -
             
     | 
| 
       374 
333 
     | 
    
         
             
                  when 'GeeTestTask'
         
     | 
| 
       375 
334 
     | 
    
         
             
                    args[:task] = {
         
     | 
| 
       376 
335 
     | 
    
         
             
                      type:       'GeeTestTask',
         
     | 
| 
         @@ -385,9 +344,11 @@ module AntiCaptcha 
     | 
|
| 
       385 
344 
     | 
    
         | 
| 
       386 
345 
     | 
    
         
             
                  when 'TurnstileTask'
         
     | 
| 
       387 
346 
     | 
    
         
             
                    args[:task] = {
         
     | 
| 
       388 
     | 
    
         
            -
                      type: 
     | 
| 
       389 
     | 
    
         
            -
                      websiteURL: 
     | 
| 
       390 
     | 
    
         
            -
                      websiteKey: 
     | 
| 
      
 347 
     | 
    
         
            +
                      type:           'TurnstileTask',
         
     | 
| 
      
 348 
     | 
    
         
            +
                      websiteURL:     options[:website_url],
         
     | 
| 
      
 349 
     | 
    
         
            +
                      websiteKey:     options[:website_key],
         
     | 
| 
      
 350 
     | 
    
         
            +
                      action:         options[:action],
         
     | 
| 
      
 351 
     | 
    
         
            +
                      turnstileCData: options[:cdata],
         
     | 
| 
       391 
352 
     | 
    
         
             
                    }
         
     | 
| 
       392 
353 
     | 
    
         | 
| 
       393 
354 
     | 
    
         
             
                  else
         
     | 
| 
         @@ -460,8 +421,6 @@ module AntiCaptcha 
     | 
|
| 
       460 
421 
     | 
    
         
             
                #                          18 - Recaptcha V3 s0.3
         
     | 
| 
       461 
422 
     | 
    
         
             
                #                          19 - Recaptcha V3 s0.7
         
     | 
| 
       462 
423 
     | 
    
         
             
                #                          20 - Recaptcha V3 s0.9
         
     | 
| 
       463 
     | 
    
         
            -
                #                          21 - hCaptcha Proxy-On
         
     | 
| 
       464 
     | 
    
         
            -
                #                          22 - hCaptcha Proxyless
         
     | 
| 
       465 
424 
     | 
    
         
             
                #                          26 - Turnstile Proxy-On
         
     | 
| 
       466 
425 
     | 
    
         
             
                #                          27 - Turnstile Proxyless
         
     | 
| 
       467 
426 
     | 
    
         
             
                #
         
     | 
    
        data/lib/anti_captcha/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: anti_captcha
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.6.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Infosimples
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-02-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -76,7 +76,6 @@ files: 
     | 
|
| 
       76 
76 
     | 
    
         
             
            - lib/anti_captcha/http.rb
         
     | 
| 
       77 
77 
     | 
    
         
             
            - lib/anti_captcha/models/fun_captcha_solution.rb
         
     | 
| 
       78 
78 
     | 
    
         
             
            - lib/anti_captcha/models/geetest_solution.rb
         
     | 
| 
       79 
     | 
    
         
            -
            - lib/anti_captcha/models/h_captcha_solution.rb
         
     | 
| 
       80 
79 
     | 
    
         
             
            - lib/anti_captcha/models/image_to_text_solution.rb
         
     | 
| 
       81 
80 
     | 
    
         
             
            - lib/anti_captcha/models/recaptcha_v2_solution.rb
         
     | 
| 
       82 
81 
     | 
    
         
             
            - lib/anti_captcha/models/recaptcha_v3_solution.rb
         
     | 
| 
         @@ -103,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       103 
102 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       104 
103 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       105 
104 
     | 
    
         
             
            requirements: []
         
     | 
| 
       106 
     | 
    
         
            -
            rubygems_version: 3.5. 
     | 
| 
      
 105 
     | 
    
         
            +
            rubygems_version: 3.5.23
         
     | 
| 
       107 
106 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       108 
107 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       109 
108 
     | 
    
         
             
            summary: Ruby API for Anti Captcha (CAPTCHA Solver as a Service)
         
     | 
| 
         @@ -1,16 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module AntiCaptcha
         
     | 
| 
       2 
     | 
    
         
            -
              class HCaptchaSolution < AntiCaptcha::Solution
         
     | 
| 
       3 
     | 
    
         
            -
                attr_accessor :g_recaptcha_response # Deprecated
         
     | 
| 
       4 
     | 
    
         
            -
                attr_accessor :token
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                def initialize(task_result = nil)
         
     | 
| 
       8 
     | 
    
         
            -
                  super
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                  if task_result
         
     | 
| 
       11 
     | 
    
         
            -
                    @token = task_result.api_result['solution']['gRecaptchaResponse']
         
     | 
| 
       12 
     | 
    
         
            -
                    @g_recaptcha_response = token
         
     | 
| 
       13 
     | 
    
         
            -
                  end
         
     | 
| 
       14 
     | 
    
         
            -
                end
         
     | 
| 
       15 
     | 
    
         
            -
              end
         
     | 
| 
       16 
     | 
    
         
            -
            end
         
     |