Skip to content

Commit f7b009a

Browse files
authored
Update __init__.py
1 parent a27291f commit f7b009a

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

ProCap/__init__.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ def __init__(self, response: dict) -> None:
55
self.id = response.get("taskId")
66
self.time = response.get("time")
77
self.success = response.get("success")
8-
self.token = response["solution"].get("generated_pass_uuid")
98
self.error = response.get("error")
10-
self.challengeKey = response["solution"].get("challenge_key")
9+
self.status = response.get("status")
10+
self.token = response.get("solution").get("generated_pass_uuid")
11+
self.challengeKey = response.get("solution").get("challenge_key")
1112
self.response = response
13+
1214
class User:
1315
def __init__(self, response: dict) -> None:
1416
self.balance = response.get("balance")
@@ -36,24 +38,26 @@ def createTask(self, url, sitekey, proxy=None, userAgent=None, rqdata=None, isEn
3638
"rqdata": rqdata,
3739
}
3840
}
39-
if "hcaptcha" in type:
41+
if "hcaptcha" in type and isEnterprise:
4042
payload.update({"isEnterprise": isEnterprise})
41-
request = requests.post("https://api.procap.wtf/createTask", json=payload)
42-
return Task(request.json())
43+
request = requests.post("https://api.procap.wtf/createTask", json=payload).json()
44+
request["solution"] = {}
45+
return Task(request)
4346
def checkTask(self, id):
4447
request = requests.get("https://api.procap.wtf/checkTask", json={
4548
"clientKey": self.apikey,
4649
"taskId": id
4750
})
51+
print(request.text)
4852
return Task(request.json())
49-
def solve(self, url, sitekey, proxy=None, userAgent=None, rqdata=None, isEnterprise=False):
50-
task = self.createTask(url, sitekey, proxy, userAgent, rqdata, isEnterprise)
51-
if not task.error:
53+
def solve(self, url, sitekey, proxy=None, userAgent=None, rqdata=None, isEnterprise=False, type="hCaptchaTask"):
54+
task = self.createTask(url, sitekey, proxy, userAgent, rqdata, isEnterprise, type)
55+
if task.error:
5256
return task.error
5357
while True:
5458
captcha_challenge = self.checkTask(task.id)
55-
if not captcha_challenge.success:
59+
if not captcha_challenge.status == "processing" and not captcha_challenge.status == "ready":
5660
return None
57-
if captcha_challenge.success:
61+
if captcha_challenge.token:
5862
return captcha_challenge.token
5963
time.sleep(0.5)

0 commit comments

Comments
 (0)