NextCaptcha खाते के लिए साइन अप करें: NextCaptcha पर जाएं और अपनी API कुंजी प्राप्त करने के लिए साइन अप करें।
आवश्यक पायथन पैकेज स्थापित करें: सुनिश्चित करें कि आपके पास requests
स्थापित करें। यदि आपके पास यह पहले से नहीं है तो आप इसे pip का उपयोग करके स्थापित कर सकते हैं:
pip install requests
reCAPTCHA वाले पेज पर जाएँ.
पृष्ठ के स्रोत का निरीक्षण करें: पृष्ठ पर राइट-क्लिक करें और "निरीक्षण करें" या "पृष्ठ स्रोत देखें" चुनें।
साइट कुंजी खोजें: ढूंढ़ें data-sitekey
HTML में विशेषता जोड़ें। यह कुछ इस तरह दिखेगा:
<div class="g-recaptcha" data-sitekey="YOUR_SITE_KEY"></div>
इसे कॉपी करें YOUR_SITE_KEY
कीमत.
reCAPTCHA v3 को हल करने के लिए NextCaptcha को अनुरोध भेजें:
import requests
# Your NextCaptcha API key
API_KEY = 'YOUR_NextCAPTCHA_API_KEY'
# The URL of the page with the reCAPTCHA
url = 'URL_OF_THE_PAGE_WITH_RECAPTCHA'
# The site key for reCAPTCHA v3
site_key = 'YOUR_SITE_KEY'
# Requesting the reCAPTCHA solution
response = requests.post('https://api.nextcaptcha.com/createTask', data={
"clientKey": API_KEY,
"task": {
"type":"RecaptchaV3TaskProxyless",
"websiteURL":url,
"websiteKey":site_key
}
})
request_id = response.json().get('taskId')
समाधान के लिए मतदान:
import time
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'reCAPTCHA token: {recaptcha_token}')
# URL where the form is submitted
form_submit_url = 'URL_TO_SUBMIT_FORM'
# Form data including the reCAPTCHA token
form_data = {
'some_form_field': 'value',
'g-recaptcha-response': recaptcha_token
}
# Submit the form
response = requests.post(form_submit_url, data=form_data)
print(response.text)
सभी चरणों को मिलाकर, यहाँ पूरा कोड है:
import requests
import time
# Your NextCaptcha API key
API_KEY = 'YOUR_NextCAPTCHA_API_KEY'
# The URL of the page with the reCAPTCHA
url = 'URL_OF_THE_PAGE_WITH_RECAPTCHA'
# The site key for reCAPTCHA v3
site_key = 'YOUR_SITE_KEY'
# Requesting the reCAPTCHA solution
response = requests.post('https://api.nextcaptcha.com/createTask', data={
"clientKey": API_KEY,
"task": {
"type":"RecaptchaV3TaskProxyless",
"websiteURL":url,
"websiteKey":site_key
}
})
task_id = response.json().get('taskId')
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": task_id
})
if response.json().get('errorId') == 0:
solution = response.json().get('solution')
# The reCAPTCHA token
recaptcha_token = solution["gRecaptchaResponse"]
print(f'reCAPTCHA token: {recaptcha_token}')
# URL where the form is submitted
form_submit_url = 'URL_TO_SUBMIT_FORM'
# Form data including the reCAPTCHA token
form_data = {
'some_form_field': 'value',
'g-recaptcha-response': recaptcha_token
}
# Submit the form
response = requests.post(form_submit_url, data=form_data)
print(response.text)