fix seriehd, guardaserie e aggiornati link canali

This commit is contained in:
marco
2020-03-25 20:33:50 +01:00
parent 3199fc568e
commit dffd7d52e9
15 changed files with 108 additions and 167 deletions

View File

@@ -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)
)

View File

@@ -2,18 +2,23 @@ from __future__ import absolute_import
import re
import requests
import reCaptcha_exceptions
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/"
)
from ..exceptions import (
reCaptchaServiceUnavailable,
reCaptchaAPIError,
reCaptchaTimeout,
reCaptchaParameter,
reCaptchaBadJobID
)
from . import reCaptcha
@@ -30,7 +35,7 @@ class captchaSolver(reCaptcha):
@staticmethod
def checkErrorStatus(response):
if response.status_code in [500, 502]:
raise reCaptcha_exceptions.reCaptcha_Service_Unavailable(
raise reCaptchaServiceUnavailable(
'9kw: Server Side Error {}'.format(response.status_code)
)
@@ -93,17 +98,17 @@ class captchaSolver(reCaptcha):
if response.text.startswith('{'):
if response.json().get('error'):
raise reCaptcha_exceptions.reCaptcha_Error_From_API(error_codes.get(int(response.json().get('error'))))
raise reCaptchaAPIError(error_codes.get(int(response.json().get('error'))))
else:
error_code = int(re.search(r'^00(?P<error_code>\d+)', response.text).groupdict().get('error_code', 0))
if error_code:
raise reCaptcha_exceptions.reCaptcha_Error_From_API(error_codes.get(error_code))
raise reCaptchaAPIError(error_codes.get(error_code))
# ------------------------------------------------------------------------------- #
def requestJob(self, jobID):
if not jobID:
raise reCaptcha_exceptions.reCaptcha_Bad_Job_ID(
raise reCaptchaBadJobID(
"9kw: Error bad job id to request reCaptcha against."
)
@@ -134,7 +139,7 @@ class captchaSolver(reCaptcha):
if response:
return response.json().get('answer')
else:
raise reCaptcha_exceptions.reCaptcha_Timeout("9kw: Error failed to solve reCaptcha.")
raise reCaptchaTimeout("9kw: Error failed to solve reCaptcha.")
# ------------------------------------------------------------------------------- #
@@ -170,7 +175,7 @@ class captchaSolver(reCaptcha):
if response:
return response.json().get('captchaid')
else:
raise reCaptcha_exceptions.reCaptcha_Bad_Job_ID('9kw: Error no valid job id was returned.')
raise reCaptchaBadJobID('9kw: Error no valid job id was returned.')
# ------------------------------------------------------------------------------- #
@@ -178,7 +183,7 @@ class captchaSolver(reCaptcha):
jobID = None
if not reCaptchaParams.get('api_key'):
raise reCaptcha_exceptions.reCaptcha_Bad_Parameter("9kw: Missing api_key parameter.")
raise reCaptchaParameter("9kw: Missing api_key parameter.")
self.api_key = reCaptchaParams.get('api_key')
@@ -192,7 +197,7 @@ class captchaSolver(reCaptcha):
jobID = self.requestSolve(site_url, site_key)
return self.requestJob(jobID)
except polling.TimeoutException:
raise reCaptcha_exceptions.reCaptcha_Timeout(
raise reCaptchaTimeout(
"9kw: reCaptcha solve took to long to execute 'captchaid' {}, aborting.".format(jobID)
)

View File

@@ -1,6 +1,6 @@
import sys
import logging
import abc
import logging
import sys
if sys.version_info >= (3, 4):
ABC = abc.ABC # noqa

View File

@@ -1,13 +1,14 @@
from __future__ import absolute_import
import sys
import reCaptcha_exceptions
from ..exceptions import reCaptchaParameter
try:
from python_anticaptcha import AnticaptchaClient, NoCaptchaTaskProxylessTask
from python_anticaptcha import (
AnticaptchaClient,
NoCaptchaTaskProxylessTask
)
except ImportError:
sys.tracebacklimit = 0
raise reCaptcha_exceptions.reCaptcha_Import_Error(
raise ImportError(
"Please install the python module 'python_anticaptcha' via pip or download it from "
"https://github.com/ad-m/python-anticaptcha"
)
@@ -24,7 +25,7 @@ class captchaSolver(reCaptcha):
def getCaptchaAnswer(self, site_url, site_key, reCaptchaParams):
if not reCaptchaParams.get('api_key'):
raise reCaptcha_exceptions.reCaptcha_Bad_Parameter("anticaptcha: Missing api_key parameter.")
raise reCaptchaParameter("anticaptcha: Missing api_key parameter.")
client = AnticaptchaClient(reCaptchaParams.get('api_key'))
@@ -34,9 +35,9 @@ class captchaSolver(reCaptcha):
task = NoCaptchaTaskProxylessTask(site_url, site_key)
if not hasattr(client, 'createTaskSmee'):
sys.tracebacklimit = 0
raise reCaptcha_exceptions.reCaptcha_Import_Error(
"Please upgrade 'python_anticaptcha' via pip or download it from https://github.com/ad-m/python-anticaptcha"
raise NotImplementedError(
"Please upgrade 'python_anticaptcha' via pip or download it from "
"https://github.com/ad-m/python-anticaptcha"
)
job = client.createTaskSmee(task)

View File

@@ -2,18 +2,24 @@ from __future__ import absolute_import
import json
import requests
import reCaptcha_exceptions
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/"
)
from ..exceptions import (
reCaptchaServiceUnavailable,
reCaptchaAccountError,
reCaptchaTimeout,
reCaptchaParameter,
reCaptchaBadJobID,
reCaptchaReportError
)
from . import reCaptcha
@@ -38,7 +44,7 @@ class captchaSolver(reCaptcha):
)
if response.status_code in errors:
raise reCaptcha_exceptions.reCaptcha_Service_Unavailable(errors.get(response.status_code))
raise reCaptchaServiceUnavailable(errors.get(response.status_code))
# ------------------------------------------------------------------------------- #
@@ -49,10 +55,10 @@ class captchaSolver(reCaptcha):
def _checkRequest(response):
if response.ok:
if response.json().get('is_banned'):
raise reCaptcha_exceptions.reCaptcha_Account_Error('DeathByCaptcha: Your account is banned.')
raise reCaptchaAccountError('DeathByCaptcha: Your account is banned.')
if response.json().get('balanace') == 0:
raise reCaptcha_exceptions.reCaptcha_Account_Error('DeathByCaptcha: insufficient credits.')
raise reCaptchaAccountError('DeathByCaptcha: insufficient credits.')
return response
@@ -80,7 +86,7 @@ class captchaSolver(reCaptcha):
def reportJob(self, jobID):
if not jobID:
raise reCaptcha_exceptions.reCaptcha_Bad_Job_ID(
raise reCaptchaBadJobID(
"DeathByCaptcha: Error bad job id to report failed reCaptcha."
)
@@ -109,7 +115,7 @@ class captchaSolver(reCaptcha):
if response:
return True
else:
raise reCaptcha_exceptions.reCaptcha_Report_Error(
raise reCaptchaReportError(
"DeathByCaptcha: Error report failed reCaptcha."
)
@@ -117,7 +123,7 @@ class captchaSolver(reCaptcha):
def requestJob(self, jobID):
if not jobID:
raise reCaptcha_exceptions.reCaptcha_Bad_Job_ID(
raise reCaptchaBadJobID(
"DeathByCaptcha: Error bad job id to request reCaptcha."
)
@@ -142,7 +148,7 @@ class captchaSolver(reCaptcha):
if response:
return response.json().get('text')
else:
raise reCaptcha_exceptions.reCaptcha_Timeout(
raise reCaptchaTimeout(
"DeathByCaptcha: Error failed to solve reCaptcha."
)
@@ -180,7 +186,7 @@ class captchaSolver(reCaptcha):
if response:
return response.json().get('captcha')
else:
raise reCaptcha_exceptions.reCaptcha_Bad_Job_ID(
raise reCaptchaBadJobID(
'DeathByCaptcha: Error no job id was returned.'
)
@@ -191,7 +197,7 @@ class captchaSolver(reCaptcha):
for param in ['username', 'password']:
if not reCaptchaParams.get(param):
raise reCaptcha_exceptions.reCaptcha_Bad_Parameter(
raise reCaptchaParameter(
"DeathByCaptcha: Missing '{}' parameter.".format(param)
)
setattr(self, param, reCaptchaParams.get(param))
@@ -207,11 +213,11 @@ class captchaSolver(reCaptcha):
if jobID:
self.reportJob(jobID)
except polling.TimeoutException:
raise reCaptcha_exceptions.reCaptcha_Timeout(
raise reCaptchaTimeout(
"DeathByCaptcha: reCaptcha solve took to long and also failed reporting the job id {}.".format(jobID)
)
raise reCaptcha_exceptions.reCaptcha_Timeout(
raise reCaptchaTimeout(
"DeathByCaptcha: reCaptcha solve took to long to execute job id {}, aborting.".format(jobID)
)