import asyncio
import aiohttp
import json
import time
class FunCaptcha:
async def send_get_request(self, url):
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
if response.status == 200:
return await response.text()
else:
print(f"Error: {response.status} - {response.reason}")
return None
async def get_captcha(self, api_key, fun_captcha_site_key):
result = ""
max_attempts = 60
attempts = 0
while attempts < max_attempts:
create_tasking_url = f"https://fun.vocopus.com/FunCaptcha?key={api_key}&FunCaptchaSiteKey={fun_captcha_site_key}"
create_tasking_response = await self.send_get_request(create_tasking_url)
json_response = json.loads(create_tasking_response)
if "error" in json_response and json_response["error"] == "Yetersiz bakiye":
print("Hata: Yetersiz bakiye. İşlemler iptal edildi.")
return "Yetersiz bakiye"
if "error" in json_response and json_response["error"] == "Kullanıcı bulunamadı":
print("Hata: Api Key Hatalı")
return "Api Key Hatalı"
order_id_value = json_response.get("orderID")
if order_id_value:
while True:
order_id = order_id_value
check_tasking_url = f"https://fun.vocopus.com/FunCaptcha?key={api_key}&orderID={order_id}"
check_tasking_response = await self.send_get_request(check_tasking_url)
check_tasking_json = json.loads(check_tasking_response)
status = check_tasking_json.get("order", {}).get("status")
if status == "Success":
token = check_tasking_json.get("order", {}).get("token")
result = token
print("Success! Exiting the loop.")
return result
elif status == "Fail":
print("Fail status received. Exiting the loop.")
break
await asyncio.sleep(1)
attempts += 1
await asyncio.sleep(1)
return result
async def main():
api_key = "Your_Api_Key"
twitter_site_key = "2CB16598-CB82-4CF7-B332-5990DB66F3AB"
fun_captcha = FunCaptcha()
captcha_response = await fun_captcha.get_captcha(api_key, twitter_site_key)
# Captcha token'ını kullanarak başka işlemler yapabilirsiniz
# ...
if _name_ == "_main_":
asyncio.run(main())