Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
VirusNoirrr authored May 7, 2024
1 parent a27291f commit f7b009a
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions ProCap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ def __init__(self, response: dict) -> None:
self.id = response.get("taskId")
self.time = response.get("time")
self.success = response.get("success")
self.token = response["solution"].get("generated_pass_uuid")
self.error = response.get("error")
self.challengeKey = response["solution"].get("challenge_key")
self.status = response.get("status")
self.token = response.get("solution").get("generated_pass_uuid")
self.challengeKey = response.get("solution").get("challenge_key")
self.response = response

class User:
def __init__(self, response: dict) -> None:
self.balance = response.get("balance")
Expand Down Expand Up @@ -36,24 +38,26 @@ def createTask(self, url, sitekey, proxy=None, userAgent=None, rqdata=None, isEn
"rqdata": rqdata,
}
}
if "hcaptcha" in type:
if "hcaptcha" in type and isEnterprise:
payload.update({"isEnterprise": isEnterprise})
request = requests.post("https://api.procap.wtf/createTask", json=payload)
return Task(request.json())
request = requests.post("https://api.procap.wtf/createTask", json=payload).json()
request["solution"] = {}
return Task(request)
def checkTask(self, id):
request = requests.get("https://api.procap.wtf/checkTask", json={
"clientKey": self.apikey,
"taskId": id
})
print(request.text)
return Task(request.json())
def solve(self, url, sitekey, proxy=None, userAgent=None, rqdata=None, isEnterprise=False):
task = self.createTask(url, sitekey, proxy, userAgent, rqdata, isEnterprise)
if not task.error:
def solve(self, url, sitekey, proxy=None, userAgent=None, rqdata=None, isEnterprise=False, type="hCaptchaTask"):
task = self.createTask(url, sitekey, proxy, userAgent, rqdata, isEnterprise, type)
if task.error:
return task.error
while True:
captcha_challenge = self.checkTask(task.id)
if not captcha_challenge.success:
if not captcha_challenge.status == "processing" and not captcha_challenge.status == "ready":
return None
if captcha_challenge.success:
if captcha_challenge.token:
return captcha_challenge.token
time.sleep(0.5)

0 comments on commit f7b009a

Please sign in to comment.