पायथन वातावरण सेट अप करें:
सुनिश्चित करें कि आपके पास Python इंस्टॉल है। आपको आवश्यक लाइब्रेरीज़ भी इंस्टॉल करनी होंगी जैसे कि requests
.
pip install requests
NextCaptcha के लिए साइन अप करें:
NextCaptcha के साथ एक खाता पंजीकृत करें और अपनी API कुंजी प्राप्त करें।
NextCaptcha का उपयोग करके reCAPTCHA v3 को हल करें।:
NextCaptcha reCAPTCHA चुनौतियों को हल करने के लिए एक API प्रदान करता है। आपको उनकी सेवा को एक अनुरोध भेजने की आवश्यकता है, और वे एक टोकन लौटाएंगे जिसका उपयोग CAPTCHA को बायपास करने के लिए किया जा सकता है।
अपने एप्लिकेशन के साथ एकीकृत करें:
अपने एप्लिकेशन में reCAPTCHA को बायपास करने के लिए NextCaptcha द्वारा प्रदान किए गए टोकन का उपयोग करें।import requests
# Your NextCaptcha API key
api_key = 'YOUR_NEXTCAPTCHA_API_KEY'
site_key = '6LcAbwIqAAAAAJvVAhSSJ8qzYsujc7kn1knmSgQX'
page_url = 'https://nextcaptcha.com/'
# Step 1: Send a request to NextCaptcha to solve the reCAPTCHA
captcha_request_url = 'https://api.nextcaptcha.com/createTask'
payload = {
'clientKey': api_key,
'task': {
'type':'RecaptchaV3TaskProxyless',
'websiteURL': page_url,
'websiteKey': site_key,
'pageAction': 'submit'
}
}
response = requests.post(captcha_request_url, data=payload)
if response.status_code != 200:
print('Failed to send request to NextCaptcha')
exit()
response_data = response.json()
captcha_id = response_data.get('taskId')
# Step 2: Retrieve the solved token from NextCaptcha
retrieve_url = 'https://api.nextcaptcha.com/getTaskResult'
params = {
'clientKey': api_key,
'taskId': captcha_id
}
solution = None
while solution is None:
time.sleep(1) # Wait a few seconds before checking again
response = requests.post('https://api.nextcaptcha.com/getTaskResult', data={
"clientKey": "api key",
"taskId": request_id
})
if response.json().get('errorId') == 0:
solution = response.json().get('solution')
# The reCAPTCHA token
recaptcha_token = solution["gRecaptchaResponse"]
print(f'Successfully retrieved token: {recaptcha_token}')
# Step 3: Use the token in the verify API endpoint
verify_url = 'https://next.nextcaptcha.com/api/captcha-demo/recaptcha_enterprise/verify'
verify_payload = {
'siteKey': site_key,
'gRecaptchaResponse': token,
'action': 'submit'
}
verify_response = requests.post(verify_url, json=verify_payload)
if verify_response.status_code == 200:
print('Verification response:', verify_response.json())
else:
print('Failed to verify token')