Skip to content

Commit

Permalink
Merge pull request #13 from adrdinu/add_turnstile_optional_params_sup…
Browse files Browse the repository at this point in the history
…port

Adds support for Turnstile action and turnstileCData optional params
  • Loading branch information
adrianodennanni authored Feb 21, 2025
2 parents 240c3d0 + 8f1b00a commit 9980b99
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ solution.v4['captcha_output']
solution = client.decode_turnstile!(
website_key: 'xyz',
website_url: 'http://example.com/example=1',
# action: 'contact_form', # OPTIONAL
# cdata: 'xyz', # OPTIONAL
# proxy_type: 'http', # OPTIONAL
# proxy_address: '127.0.0.1', # OPTIONAL
# proxy_port: '8080', # OPTIONAL
Expand All @@ -226,6 +228,8 @@ solution.token

- `website_key`: the site key for the Turnstile.
- `website_url`: the URL of the page with the Turnstile challenge.
- `action`: optional parameter. Turnstile challenge unique action.
- `cdata`: optional parameter. Turnstile challenge cData token.
- `proxy_type`: optional parameter. Proxy connection protocol.
- `proxy_address`: optional parameter. The proxy address.
- `proxy_port`: optional parameter. The proxy port.
Expand Down
10 changes: 7 additions & 3 deletions lib/anti_captcha/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ def decode_turnstile(options, proxy = nil)
# @param [Hash] options Options hash.
# @option options [String] :website_url
# @option options [String] :website_key
# @option options [String] :action
# @option options [String] :cdata
#
# @param [Hash] proxy Not mandatory. A hash with configs of the proxy that
# has to be used. Defaults to `nil`.
Expand Down Expand Up @@ -342,9 +344,11 @@ def create_task!(type, options, proxy = nil)

when 'TurnstileTask'
args[:task] = {
type: 'TurnstileTask',
websiteURL: options[:website_url],
websiteKey: options[:website_key],
type: 'TurnstileTask',
websiteURL: options[:website_url],
websiteKey: options[:website_key],
action: options[:action],
turnstileCData: options[:cdata],
}

else
Expand Down
2 changes: 1 addition & 1 deletion lib/anti_captcha/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module AntiCaptcha
VERSION = "2.5.0"
VERSION = "2.6.0"
USER_AGENT = "AntiCaptcha/Ruby v#{VERSION}"
end

0 comments on commit 9980b99

Please sign in to comment.