fix seriehd, guardaserie e aggiornati link canali
This commit is contained in:
@@ -1,14 +1,21 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import requests
|
||||
import reCaptcha_exceptions
|
||||
|
||||
|
||||
from ..exceptions import (
|
||||
reCaptchaServiceUnavailable,
|
||||
reCaptchaAPIError,
|
||||
reCaptchaTimeout,
|
||||
reCaptchaParameter,
|
||||
reCaptchaBadJobID,
|
||||
reCaptchaReportError
|
||||
)
|
||||
|
||||
try:
|
||||
import polling
|
||||
except ImportError:
|
||||
import sys
|
||||
sys.tracebacklimit = 0
|
||||
raise reCaptcha_exceptions.reCaptcha_Import_Error(
|
||||
raise ImportError(
|
||||
"Please install the python module 'polling' via pip or download it from "
|
||||
"https://github.com/justiniso/polling/"
|
||||
)
|
||||
@@ -28,7 +35,7 @@ class captchaSolver(reCaptcha):
|
||||
@staticmethod
|
||||
def checkErrorStatus(response, request_type):
|
||||
if response.status_code in [500, 502]:
|
||||
raise reCaptcha_exceptions.reCaptcha_Service_Unavailable('2Captcha: Server Side Error {}'.format(response.status_code))
|
||||
raise reCaptchaServiceUnavailable('2Captcha: Server Side Error {}'.format(response.status_code))
|
||||
|
||||
errors = {
|
||||
'in.php': {
|
||||
@@ -75,7 +82,7 @@ class captchaSolver(reCaptcha):
|
||||
}
|
||||
|
||||
if response.json().get('status') is False and response.json().get('request') in errors.get(request_type):
|
||||
raise reCaptcha_exceptions.reCaptcha_Error_From_API(
|
||||
raise reCaptchaAPIError(
|
||||
'{} {}'.format(
|
||||
response.json().get('request'),
|
||||
errors.get(request_type).get(response.json().get('request'))
|
||||
@@ -86,7 +93,7 @@ class captchaSolver(reCaptcha):
|
||||
|
||||
def reportJob(self, jobID):
|
||||
if not jobID:
|
||||
raise reCaptcha_exceptions.reCaptcha_Bad_Job_ID(
|
||||
raise reCaptchaBadJobID(
|
||||
"2Captcha: Error bad job id to request reCaptcha."
|
||||
)
|
||||
|
||||
@@ -116,7 +123,7 @@ class captchaSolver(reCaptcha):
|
||||
if response:
|
||||
return True
|
||||
else:
|
||||
raise reCaptcha_exceptions.reCaptcha_Report_Error(
|
||||
raise reCaptchaReportError(
|
||||
"2Captcha: Error - Failed to report bad reCaptcha solve."
|
||||
)
|
||||
|
||||
@@ -124,7 +131,7 @@ class captchaSolver(reCaptcha):
|
||||
|
||||
def requestJob(self, jobID):
|
||||
if not jobID:
|
||||
raise RuntimeError("2Captcha: Error bad job id to request reCaptcha.")
|
||||
raise reCaptchaBadJobID("2Captcha: Error bad job id to request reCaptcha.")
|
||||
|
||||
def _checkRequest(response):
|
||||
if response.ok and response.json().get('status') == 1:
|
||||
@@ -152,7 +159,7 @@ class captchaSolver(reCaptcha):
|
||||
if response:
|
||||
return response.json().get('request')
|
||||
else:
|
||||
raise reCaptcha_exceptions.reCaptcha_Timeout(
|
||||
raise reCaptchaTimeout(
|
||||
"2Captcha: Error failed to solve reCaptcha."
|
||||
)
|
||||
|
||||
@@ -188,7 +195,7 @@ class captchaSolver(reCaptcha):
|
||||
if response:
|
||||
return response.json().get('request')
|
||||
else:
|
||||
raise reCaptcha_exceptions.reCaptcha_Bad_Job_ID(
|
||||
raise reCaptchaBadJobID(
|
||||
'2Captcha: Error no job id was returned.'
|
||||
)
|
||||
|
||||
@@ -198,7 +205,7 @@ class captchaSolver(reCaptcha):
|
||||
jobID = None
|
||||
|
||||
if not reCaptchaParams.get('api_key'):
|
||||
raise reCaptcha_exceptions.reCaptcha_Bad_Parameter(
|
||||
raise reCaptchaParameter(
|
||||
"2Captcha: Missing api_key parameter."
|
||||
)
|
||||
|
||||
@@ -215,11 +222,11 @@ class captchaSolver(reCaptcha):
|
||||
if jobID:
|
||||
self.reportJob(jobID)
|
||||
except polling.TimeoutException:
|
||||
raise reCaptcha_exceptions.reCaptcha_Timeout(
|
||||
raise reCaptchaTimeout(
|
||||
"2Captcha: reCaptcha solve took to long and also failed reporting the job the job id {}.".format(jobID)
|
||||
)
|
||||
|
||||
raise reCaptcha_exceptions.reCaptcha_Timeout(
|
||||
raise reCaptchaTimeout(
|
||||
"2Captcha: reCaptcha solve took to long to execute job id {}, aborting.".format(jobID)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user