Skip to content

Commit

Permalink
- Updated parameter values in the examples folder for hcaptcha, keyca…
Browse files Browse the repository at this point in the history
…ptcha, lemin, recaptcha

- Added comments about dynamic parameters for geetest and amazon

Signed-off-by: Maxim S <[email protected]>
  • Loading branch information
poplers24 committed Jun 10, 2024
1 parent b5917cc commit 4c70fcc
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 32 deletions.
5 changes: 5 additions & 0 deletions examples/amazon_waf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@

solver = TwoCaptcha(api_key)

"""
Important: the values of the 'iv' and 'context' parameters are dynamic, for every request to our API you need to get new values.
The values 'iv' and 'context' need to be looked for in the page code.
"""

try:
result = solver.amazon_waf(
sitekey='AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AFsClhVgr5q0UFRdXhhHEwiAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMLMbH8d6uQSrYTraoAgEQgDvtSNxdEyG7Zu393cHyPdWNCZgeIB52+W7fCTI8U5z15z1NdPUdnB1ZHoK7ewpwoSMm5mzkJJld0cnvGw==',
Expand Down
5 changes: 5 additions & 0 deletions examples/amazon_waf_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@

solver = TwoCaptcha(**config)

"""
Important: the values of the 'iv' and 'context' parameters are dynamic, for every request to our API you need to get new values.
The values 'iv' and 'context' need to be looked for in the page code.
"""

try:
result = solver.amazon_waf(sitekey='AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AGIqvS8v6ScFa8ZpNRrlQgKAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMx9gxoe10Zg35PWhzAgEQgDvUtMMkqkFQByMLK2329D8iX4mjvaTuUhU70LD4vLp54v3+4K1nYY2hB+OM1hMbncnMbP63y4UOrY77jg==',
iv='CgAGVTNd9JAAAAnB',
Expand Down
16 changes: 10 additions & 6 deletions examples/geetest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@

solver = TwoCaptcha(api_key)

resp = requests.get("https://www.mysite.com/distil_r_captcha_challenge")
challenge = resp.content.decode('utf-8').split(';')[0]
"""
Important: the value of the 'challenge' parameter is dynamic, for each request to our API you need to get a new value.
"""

resp = requests.get("https://2captcha.com/api/v1/captcha-demo/gee-test/init-params")
challenge = resp.json()['challenge']

try:
result = solver.geetest(gt='f3bf6dbdcf7886856696502e1d55e00c',
apiServer='api-na.geetest.com',
result = solver.geetest(gt='81388ea1fc187e0c335c0a8907ff2625',
apiServer='http://api.geetest.com',
challenge=challenge,
url='https://www.mysite.com/distil_r_captcha.html')
url='https://2captcha.com/demo/geetest')

except Exception as e:
sys.exit(e)

else:
sys.exit('result: ' + str(result))
sys.exit('result: ' + str(result))
16 changes: 10 additions & 6 deletions examples/geetest_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@

solver = TwoCaptcha(api_key, defaultTimeout=300, pollingInterval=10)

resp = requests.get("https://www.mysite.com/distil_r_captcha_challenge")
challenge = resp.content.decode('utf-8').split(';')[0]
"""
Important: the value of the 'challenge' parameter is dynamic, for each request to our API you need to get a new value.
"""

resp = requests.get("https://2captcha.com/api/v1/captcha-demo/gee-test/init-params")
challenge = resp.json()['challenge']

try:
result = solver.geetest(
gt='f3bf6dbdcf7886856696502e1d55e00c',
apiServer='api-na.geetest.com',
gt='81388ea1fc187e0c335c0a8907ff2625',
apiServer='http://api.geetest.com',
challenge=challenge,
url='https://www.mysite.com/distil_r_captcha.html',
url='https://2captcha.com/demo/geetest',
# proxy={
# 'type': 'HTTPS',
# 'uri': 'login:password@IP_address:PORT'
Expand All @@ -34,4 +38,4 @@
sys.exit(e)

else:
sys.exit('result: ' + str(result))
sys.exit('result: ' + str(result))
2 changes: 1 addition & 1 deletion examples/hcaptcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

try:
result = solver.hcaptcha(
sitekey='3ceb8624-1970-4e6b-91d5-70317b70b651',
sitekey='41b778e7-8f20-45cc-a804-1f1ebb45c579',
url='https://2captcha.com/demo/hcaptcha?difficulty=easy',
)

Expand Down
10 changes: 5 additions & 5 deletions examples/keycaptcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

try:
result = solver.keycaptcha(
s_s_c_user_id=15,
s_s_c_session_id='faa8cc1697c962ad4b859aa472f5d992',
s_s_c_web_server_sign='4f84e4fe41cf688d8d94361489ecd75c-pz-',
s_s_c_web_server_sign2='a9af97bb0a645eec495f2527e431a21b',
url='https://www.keycaptcha.com/products/')
s_s_c_user_id=184015,
s_s_c_session_id='e34ddd2c72e67593ac0b4ca8e4f44725',
s_s_c_web_server_sign='a5ebd41ae22348b2cdbdc211792e982d',
s_s_c_web_server_sign2='29255689423dd92990f8d06de50560d0',
url='https://2captcha.com/demo/keycaptcha')

except Exception as e:
sys.exit(e)
Expand Down
17 changes: 8 additions & 9 deletions examples/keycaptcha_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@
solver = TwoCaptcha(**config)

try:
result = solver.keycaptcha(s_s_c_user_id = 184015,
s_s_c_session_id = 'c32c9934c68b2968bee0332b9346da42',
s_s_c_web_server_sign = 'c93c8d136d5ee6ee6fe27ab2be54901d',
s_s_c_web_server_sign2 = 'eec85fcfeda28bffd7764d712d4089e7',
url = 'https://2captcha.com/ru/demo/keycaptcha'
# proxy = {
# 'type': 'HTTPS',
# 'uri': 'login:password@IP_address:PORT'}
)
result = solver.keycaptcha(s_s_c_user_id=184015,
s_s_c_session_id='e34ddd2c72e67593ac0b4ca8e4f44725',
s_s_c_web_server_sign='a5ebd41ae22348b2cdbdc211792e982d',
s_s_c_web_server_sign2='29255689423dd92990f8d06de50560d0',
url='https://2captcha.com/demo/keycaptcha',
# proxy = {'type': 'HTTPS',
# 'uri': 'login:password@IP_address:PORT'}
)


except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion examples/lemin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
solver = TwoCaptcha(api_key)

try:
result = solver.lemin(captcha_id='CROPPED_3dfdd5c_d1872b526b794d83ba3b365eb15a200b',
result = solver.lemin(captcha_id='CROPPED_5a29582_ca114c2f3314482c84cd32fc7d2feb63',
div_id='lemin-cropped-captcha',
url='https://2captcha.com/demo/lemin')

Expand Down
4 changes: 2 additions & 2 deletions examples/recaptcha_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

try:
result = solver.recaptcha(
sitekey='6LfDxboZAAAAAD6GHukjvUy6lszoeG3H4nQW57b6',
url='https://2captcha.com/demo/recaptcha-v2-invisible?level=low')
sitekey='6LdO5_IbAAAAAAeVBL9TClS19NUTt5wswEb3Q7C5',
url='https://2captcha.com/demo/recaptcha-v2-invisible')

except Exception as e:
sys.exit(e)
Expand Down
4 changes: 2 additions & 2 deletions examples/recaptcha_v2_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

try:
result = solver.recaptcha(
sitekey='6LfDxboZAAAAAD6GHukjvUy6lszoeG3H4nQW57b6',
url='https://2captcha.com/demo/recaptcha-v2-invisible?level=low',
sitekey='6LdO5_IbAAAAAAeVBL9TClS19NUTt5wswEb3Q7C5',
url='https://2captcha.com/demo/recaptcha-v2-invisible',
invisible=1,
enterprise=0
# proxy={
Expand Down

0 comments on commit 4c70fcc

Please sign in to comment.