Aggiornato Cloudscraper
This commit is contained in:
@@ -103,7 +103,7 @@ class captchaSolver(Captcha):
|
||||
|
||||
response = polling2.poll(
|
||||
lambda: self.session.get(
|
||||
'{}/res.php'.format(self.host),
|
||||
f'{self.host}/res.php',
|
||||
params={
|
||||
'key': self.api_key,
|
||||
'action': 'reportbad',
|
||||
@@ -138,7 +138,7 @@ class captchaSolver(Captcha):
|
||||
|
||||
response = polling2.poll(
|
||||
lambda: self.session.get(
|
||||
'{}/res.php'.format(self.host),
|
||||
f'{self.host}/res.php',
|
||||
params={
|
||||
'key': self.api_key,
|
||||
'action': 'get',
|
||||
@@ -195,7 +195,7 @@ class captchaSolver(Captcha):
|
||||
|
||||
response = polling2.poll(
|
||||
lambda: self.session.post(
|
||||
'{}/in.php'.format(self.host),
|
||||
f'{self.host}/in.php',
|
||||
data=data,
|
||||
allow_redirects=False,
|
||||
timeout=30
|
||||
|
||||
@@ -36,7 +36,7 @@ class captchaSolver(reCaptcha):
|
||||
def checkErrorStatus(response):
|
||||
if response.status_code in [500, 502]:
|
||||
raise reCaptchaServiceUnavailable(
|
||||
'9kw: Server Side Error {}'.format(response.status_code)
|
||||
f'9kw: Server Side Error {response.status_code}'
|
||||
)
|
||||
|
||||
error_codes = {
|
||||
|
||||
@@ -25,12 +25,12 @@ class Captcha(ABC):
|
||||
def dynamicImport(cls, name):
|
||||
if name not in captchaSolvers:
|
||||
try:
|
||||
__import__('{}.{}'.format(cls.__module__, name))
|
||||
__import__(f'{cls.__module__}.{name}')
|
||||
if not isinstance(captchaSolvers.get(name), Captcha):
|
||||
raise ImportError('The anti captcha provider was not initialized.')
|
||||
except ImportError as e:
|
||||
sys.tracebacklimit = 0
|
||||
logging.error('Unable to load {} anti captcha provider -> {}'.format(name, e))
|
||||
logging.error(f'Unable to load {name} anti captcha provider -> {e}')
|
||||
raise
|
||||
|
||||
return captchaSolvers[name]
|
||||
|
||||
@@ -36,7 +36,7 @@ class captchaSolver(Captcha):
|
||||
def checkErrorStatus(response):
|
||||
if response.status_code in [500, 502]:
|
||||
raise CaptchaServiceUnavailable(
|
||||
'CapMonster: Server Side Error {}'.format(response.status_code)
|
||||
f'CapMonster: Server Side Error {response.status_code}'
|
||||
)
|
||||
|
||||
payload = response.json()
|
||||
@@ -66,7 +66,7 @@ class captchaSolver(Captcha):
|
||||
|
||||
response = polling2.poll(
|
||||
lambda: self.session.post(
|
||||
'{}/getTaskResult'.format(self.host),
|
||||
f'{self.host}/getTaskResult',
|
||||
json={
|
||||
'clientKey': self.clientKey,
|
||||
'taskId': taskID
|
||||
@@ -101,9 +101,9 @@ class captchaSolver(Captcha):
|
||||
'task': {
|
||||
'websiteURL': url,
|
||||
'websiteKey': siteKey,
|
||||
'softId': 37,
|
||||
'type': 'NoCaptchaTask' if captchaType == 'reCaptcha' else 'HCaptchaTask'
|
||||
}
|
||||
},
|
||||
'softId': 37
|
||||
}
|
||||
|
||||
if self.proxy:
|
||||
@@ -113,7 +113,7 @@ class captchaSolver(Captcha):
|
||||
|
||||
response = polling2.poll(
|
||||
lambda: self.session.post(
|
||||
'{}/createTask'.format(self.host),
|
||||
f'{self.host}/createTask',
|
||||
json=data,
|
||||
allow_redirects=False,
|
||||
timeout=30
|
||||
|
||||
@@ -68,7 +68,7 @@ class captchaSolver(Captcha):
|
||||
|
||||
response = polling2.poll(
|
||||
lambda: self.session.post(
|
||||
'{}/user'.format(self.host),
|
||||
f'{self.host}/user',
|
||||
headers={'Accept': 'application/json'},
|
||||
data={
|
||||
'username': self.username,
|
||||
@@ -100,7 +100,7 @@ class captchaSolver(Captcha):
|
||||
|
||||
response = polling2.poll(
|
||||
lambda: self.session.post(
|
||||
'{}/captcha/{}/report'.format(self.host, jobID),
|
||||
f'{self.host}/captcha/{jobID}/report',
|
||||
headers={'Accept': 'application/json'},
|
||||
data={
|
||||
'username': self.username,
|
||||
@@ -137,7 +137,7 @@ class captchaSolver(Captcha):
|
||||
|
||||
response = polling2.poll(
|
||||
lambda: self.session.get(
|
||||
'{}/captcha/{}'.format(self.host, jobID),
|
||||
f'{self.host}/captcha/{jobID}',
|
||||
headers={'Accept': 'application/json'}
|
||||
),
|
||||
check_success=_checkRequest,
|
||||
@@ -203,7 +203,7 @@ class captchaSolver(Captcha):
|
||||
|
||||
response = polling2.poll(
|
||||
lambda: self.session.post(
|
||||
'{}/captcha'.format(self.host),
|
||||
f'{self.host}/captcha',
|
||||
headers={'Accept': 'application/json'},
|
||||
data=data,
|
||||
allow_redirects=False
|
||||
|
||||
Reference in New Issue
Block a user