aggiornati cloudscraper e i link dei canali, fixato guardaserie
This commit is contained in:
+8
-8
@@ -17,22 +17,22 @@
|
|||||||
"dreamsub": "https://dreamsub.stream",
|
"dreamsub": "https://dreamsub.stream",
|
||||||
"dsda": "https://www.dsda.press/",
|
"dsda": "https://www.dsda.press/",
|
||||||
"fastsubita": "https://fastsubita.online",
|
"fastsubita": "https://fastsubita.online",
|
||||||
"filmgratis": "https://www.filmaltadefinizione.org",
|
"filmgratis": "https://www.filmaltadefinizione.tv",
|
||||||
"filmigratis": "https://filmigratis.org",
|
"filmigratis": "https://filmigratis.org",
|
||||||
"filmsenzalimiticc": "https://www.filmsenzalimiti.tech",
|
"filmsenzalimiticc": "https://www.filmsenzalimiti.website",
|
||||||
"filmstreaming01": "https://filmstreaming01.com",
|
"filmstreaming01": "https://filmstreaming01.com",
|
||||||
"guardaserie_stream": "https://guardaserie.store",
|
"guardaserie_stream": "https://guardaserie.store",
|
||||||
"guardaserieclick": "https://www.guardaserie.media",
|
"guardaserieclick": "https://www.guardaserie.productions",
|
||||||
"ilgeniodellostreaming": "https://ilgeniodellostreaming.ch",
|
"ilgeniodellostreaming": "https://ilgeniodellostreaming.pl",
|
||||||
"italiaserie": "https://italiaserie.org",
|
"italiaserie": "https://italiaserie.org",
|
||||||
"mondoserietv": "https://mondoserietv.com",
|
"mondoserietv": "https://mondoserietv.com",
|
||||||
"netfreex": "https://www.netfreex.pro",
|
"netfreex": "https://www.netfreex.pro",
|
||||||
"piratestreaming": "https://www.piratestreaming.digital",
|
"piratestreaming": "https://www.piratestreaming.group",
|
||||||
"polpotv": "https://polpo.tv",
|
"polpotv": "https://polpotv.club",
|
||||||
"pufimovies": "https://pufimovies.com",
|
"pufimovies": "https://pufimovies.com",
|
||||||
"raiplay": "https://www.raiplay.it",
|
"raiplay": "https://www.raiplay.it",
|
||||||
"seriehd": "https://www.seriehd.live",
|
"seriehd": "https://seriehd.life",
|
||||||
"serietvonline": "https://serietvonline.kim",
|
"serietvonline": "https://serietvonline.casa",
|
||||||
"serietvsubita": "http://serietvsubita.xyz",
|
"serietvsubita": "http://serietvsubita.xyz",
|
||||||
"serietvu": "https://www.serietvu.link",
|
"serietvu": "https://www.serietvu.link",
|
||||||
"streamtime": "https://t.me/s/StreamTime",
|
"streamtime": "https://t.me/s/StreamTime",
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ def hdpass_get_servers(item):
|
|||||||
url = url.replace("&download=1", "")
|
url = url.replace("&download=1", "")
|
||||||
if 'hdpass' not in url and 'hdplayer' not in url:
|
if 'hdpass' not in url and 'hdplayer' not in url:
|
||||||
return itemlist
|
return itemlist
|
||||||
if 'http' not in url:
|
if not url.startswith('http'):
|
||||||
url = 'https:' + url
|
url = 'https:' + url
|
||||||
|
|
||||||
data = httptools.downloadpage(url).data
|
data = httptools.downloadpage(url).data
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
# https://github.com/VeNoMouS/cloudscraper/tree/master
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import ssl
|
import ssl
|
||||||
@@ -26,6 +24,14 @@ from collections import OrderedDict
|
|||||||
from requests.sessions import Session
|
from requests.sessions import Session
|
||||||
from requests.adapters import HTTPAdapter
|
from requests.adapters import HTTPAdapter
|
||||||
|
|
||||||
|
from .exceptions import (
|
||||||
|
CloudflareLoopProtection,
|
||||||
|
CloudflareCode1020,
|
||||||
|
CloudflareIUAMError,
|
||||||
|
CloudflareReCaptchaError,
|
||||||
|
CloudflareReCaptchaProvider
|
||||||
|
)
|
||||||
|
|
||||||
from .interpreters import JavaScriptInterpreter
|
from .interpreters import JavaScriptInterpreter
|
||||||
from .reCaptcha import reCaptcha
|
from .reCaptcha import reCaptcha
|
||||||
from .user_agent import User_Agent
|
from .user_agent import User_Agent
|
||||||
@@ -45,13 +51,10 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
from urllib.parse import urlparse, urljoin
|
from urllib.parse import urlparse, urljoin
|
||||||
|
|
||||||
# Add exceptions path
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), 'exceptions'))
|
|
||||||
import cloudflare_exceptions # noqa: E402
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------- #
|
# ------------------------------------------------------------------------------- #
|
||||||
|
|
||||||
__version__ = '1.2.24'
|
__version__ = '1.2.30'
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------- #
|
# ------------------------------------------------------------------------------- #
|
||||||
|
|
||||||
@@ -215,10 +218,10 @@ class CloudScraper(Session):
|
|||||||
# ------------------------------------------------------------------------------- #
|
# ------------------------------------------------------------------------------- #
|
||||||
|
|
||||||
if self._solveDepthCnt >= self.solveDepth:
|
if self._solveDepthCnt >= self.solveDepth:
|
||||||
sys.tracebacklimit = 0
|
|
||||||
_ = self._solveDepthCnt
|
_ = self._solveDepthCnt
|
||||||
self._solveDepthCnt = 0
|
self._solveDepthCnt = 0
|
||||||
raise cloudflare_exceptions.Cloudflare_Loop_Protection(
|
sys.tracebacklimit = 0
|
||||||
|
raise CloudflareLoopProtection(
|
||||||
"!!Loop Protection!! We have tried to solve {} time(s) in a row.".format(_)
|
"!!Loop Protection!! We have tried to solve {} time(s) in a row.".format(_)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -301,7 +304,7 @@ class CloudScraper(Session):
|
|||||||
def is_Challenge_Request(self, resp):
|
def is_Challenge_Request(self, resp):
|
||||||
if self.is_Firewall_Blocked(resp):
|
if self.is_Firewall_Blocked(resp):
|
||||||
sys.tracebacklimit = 0
|
sys.tracebacklimit = 0
|
||||||
raise cloudflare_exceptions.Cloudflare_Block('Cloudflare has blocked this request (Code 1020 Detected).')
|
raise CloudflareCode1020('Cloudflare has blocked this request (Code 1020 Detected).')
|
||||||
|
|
||||||
if self.is_reCaptcha_Challenge(resp) or self.is_IUAM_Challenge(resp):
|
if self.is_reCaptcha_Challenge(resp) or self.is_IUAM_Challenge(resp):
|
||||||
return True
|
return True
|
||||||
@@ -323,7 +326,7 @@ class CloudScraper(Session):
|
|||||||
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
sys.tracebacklimit = 0
|
sys.tracebacklimit = 0
|
||||||
raise cloudflare_exceptions.Cloudflare_Error_IUAM(
|
raise CloudflareIUAMError(
|
||||||
"Cloudflare IUAM detected, unfortunately we can't extract the parameters correctly."
|
"Cloudflare IUAM detected, unfortunately we can't extract the parameters correctly."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -334,7 +337,8 @@ class CloudScraper(Session):
|
|||||||
interpreter
|
interpreter
|
||||||
).solveChallenge(body, hostParsed.netloc)
|
).solveChallenge(body, hostParsed.netloc)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise cloudflare_exceptions.Cloudflare_Error_IUAM(
|
sys.tracebacklimit = 0
|
||||||
|
raise CloudflareIUAMError(
|
||||||
'Unable to parse Cloudflare anti-bots page: {}'.format(
|
'Unable to parse Cloudflare anti-bots page: {}'.format(
|
||||||
getattr(e, 'message', e)
|
getattr(e, 'message', e)
|
||||||
)
|
)
|
||||||
@@ -362,7 +366,7 @@ class CloudScraper(Session):
|
|||||||
).groupdict()
|
).groupdict()
|
||||||
except (AttributeError):
|
except (AttributeError):
|
||||||
sys.tracebacklimit = 0
|
sys.tracebacklimit = 0
|
||||||
raise cloudflare_exceptions.Cloudflare_Error_reCaptcha(
|
raise CloudflareReCaptchaError(
|
||||||
"Cloudflare reCaptcha detected, unfortunately we can't extract the parameters correctly."
|
"Cloudflare reCaptcha detected, unfortunately we can't extract the parameters correctly."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -409,7 +413,7 @@ class CloudScraper(Session):
|
|||||||
|
|
||||||
if not self.recaptcha or not isinstance(self.recaptcha, dict) or not self.recaptcha.get('provider'):
|
if not self.recaptcha or not isinstance(self.recaptcha, dict) or not self.recaptcha.get('provider'):
|
||||||
sys.tracebacklimit = 0
|
sys.tracebacklimit = 0
|
||||||
raise cloudflare_exceptions.Cloudflare_reCaptcha_Provider(
|
raise CloudflareReCaptchaProvider(
|
||||||
"Cloudflare reCaptcha detected, unfortunately you haven't loaded an anti reCaptcha provider "
|
"Cloudflare reCaptcha detected, unfortunately you haven't loaded an anti reCaptcha provider "
|
||||||
"correctly via the 'recaptcha' parameter."
|
"correctly via the 'recaptcha' parameter."
|
||||||
)
|
)
|
||||||
@@ -445,7 +449,7 @@ class CloudScraper(Session):
|
|||||||
self.delay = delay
|
self.delay = delay
|
||||||
except (AttributeError, ValueError):
|
except (AttributeError, ValueError):
|
||||||
sys.tracebacklimit = 0
|
sys.tracebacklimit = 0
|
||||||
raise cloudflare_exceptions.Cloudflare_Error_IUAM("Cloudflare IUAM possibility malformed, issue extracing delay value.")
|
raise CloudflareIUAMError("Cloudflare IUAM possibility malformed, issue extracing delay value.")
|
||||||
|
|
||||||
sleep(self.delay)
|
sleep(self.delay)
|
||||||
|
|
||||||
@@ -584,7 +588,7 @@ class CloudScraper(Session):
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
sys.tracebacklimit = 0
|
sys.tracebacklimit = 0
|
||||||
raise cloudflare_exceptions.Cloudflare_Error_IUAM(
|
raise CloudflareIUAMError(
|
||||||
"Unable to find Cloudflare cookies. Does the site actually "
|
"Unable to find Cloudflare cookies. Does the site actually "
|
||||||
"have Cloudflare IUAM (I'm Under Attack Mode) enabled?"
|
"have Cloudflare IUAM (I'm Under Attack Mode) enabled?"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
# ------------------------------------------------------------------------------- #
|
|
||||||
|
|
||||||
|
|
||||||
class Cloudflare_Loop_Protection(Exception):
|
|
||||||
"""
|
|
||||||
Raise error for recursive depth protection
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class Cloudflare_Block(Exception):
|
|
||||||
"""
|
|
||||||
Raise error for Cloudflare 1020 block
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class Cloudflare_Error_IUAM(Exception):
|
|
||||||
"""
|
|
||||||
Raise error for problem extracting IUAM paramters from Cloudflare payload
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class Cloudflare_Error_reCaptcha(Exception):
|
|
||||||
"""
|
|
||||||
Raise error for problem extracting reCaptcha paramters from Cloudflare payload
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class Cloudflare_reCaptcha_Provider(Exception):
|
|
||||||
"""
|
|
||||||
Raise error for reCaptcha from Cloudflare, no provider loaded.
|
|
||||||
"""
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
# ------------------------------------------------------------------------------- #
|
|
||||||
|
|
||||||
|
|
||||||
class reCaptcha_Service_Unavailable(Exception):
|
|
||||||
"""
|
|
||||||
Raise error for external services that cannot be reached
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class reCaptcha_Error_From_API(Exception):
|
|
||||||
"""
|
|
||||||
Raise error for error from API response.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class reCaptcha_Account_Error(Exception):
|
|
||||||
"""
|
|
||||||
Raise error for reCaptcha provider account problem.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class reCaptcha_Timeout(Exception):
|
|
||||||
"""
|
|
||||||
Raise error for reCaptcha provider taking too long.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class reCaptcha_Bad_Parameter(NotImplementedError):
|
|
||||||
"""
|
|
||||||
Raise error for bad or missing Parameter.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class reCaptcha_Bad_Job_ID(Exception):
|
|
||||||
"""
|
|
||||||
Raise error for invalid job id.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class reCaptcha_Report_Error(Exception):
|
|
||||||
"""
|
|
||||||
Raise error for reCaptcha provider unable to report bad solve.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class reCaptcha_Import_Error(Exception):
|
|
||||||
"""
|
|
||||||
Raise error for reCaptcha, cannot import a module.
|
|
||||||
"""
|
|
||||||
@@ -1,14 +1,21 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import reCaptcha_exceptions
|
|
||||||
|
|
||||||
|
from ..exceptions import (
|
||||||
|
reCaptchaServiceUnavailable,
|
||||||
|
reCaptchaAPIError,
|
||||||
|
reCaptchaTimeout,
|
||||||
|
reCaptchaParameter,
|
||||||
|
reCaptchaBadJobID,
|
||||||
|
reCaptchaReportError
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import polling
|
import polling
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import sys
|
raise ImportError(
|
||||||
sys.tracebacklimit = 0
|
|
||||||
raise reCaptcha_exceptions.reCaptcha_Import_Error(
|
|
||||||
"Please install the python module 'polling' via pip or download it from "
|
"Please install the python module 'polling' via pip or download it from "
|
||||||
"https://github.com/justiniso/polling/"
|
"https://github.com/justiniso/polling/"
|
||||||
)
|
)
|
||||||
@@ -28,7 +35,7 @@ class captchaSolver(reCaptcha):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def checkErrorStatus(response, request_type):
|
def checkErrorStatus(response, request_type):
|
||||||
if response.status_code in [500, 502]:
|
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 = {
|
errors = {
|
||||||
'in.php': {
|
'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):
|
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(
|
'{} {}'.format(
|
||||||
response.json().get('request'),
|
response.json().get('request'),
|
||||||
errors.get(request_type).get(response.json().get('request'))
|
errors.get(request_type).get(response.json().get('request'))
|
||||||
@@ -86,7 +93,7 @@ class captchaSolver(reCaptcha):
|
|||||||
|
|
||||||
def reportJob(self, jobID):
|
def reportJob(self, jobID):
|
||||||
if not jobID:
|
if not jobID:
|
||||||
raise reCaptcha_exceptions.reCaptcha_Bad_Job_ID(
|
raise reCaptchaBadJobID(
|
||||||
"2Captcha: Error bad job id to request reCaptcha."
|
"2Captcha: Error bad job id to request reCaptcha."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -116,7 +123,7 @@ class captchaSolver(reCaptcha):
|
|||||||
if response:
|
if response:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
raise reCaptcha_exceptions.reCaptcha_Report_Error(
|
raise reCaptchaReportError(
|
||||||
"2Captcha: Error - Failed to report bad reCaptcha solve."
|
"2Captcha: Error - Failed to report bad reCaptcha solve."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,7 +131,7 @@ class captchaSolver(reCaptcha):
|
|||||||
|
|
||||||
def requestJob(self, jobID):
|
def requestJob(self, jobID):
|
||||||
if not 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):
|
def _checkRequest(response):
|
||||||
if response.ok and response.json().get('status') == 1:
|
if response.ok and response.json().get('status') == 1:
|
||||||
@@ -152,7 +159,7 @@ class captchaSolver(reCaptcha):
|
|||||||
if response:
|
if response:
|
||||||
return response.json().get('request')
|
return response.json().get('request')
|
||||||
else:
|
else:
|
||||||
raise reCaptcha_exceptions.reCaptcha_Timeout(
|
raise reCaptchaTimeout(
|
||||||
"2Captcha: Error failed to solve reCaptcha."
|
"2Captcha: Error failed to solve reCaptcha."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -188,7 +195,7 @@ class captchaSolver(reCaptcha):
|
|||||||
if response:
|
if response:
|
||||||
return response.json().get('request')
|
return response.json().get('request')
|
||||||
else:
|
else:
|
||||||
raise reCaptcha_exceptions.reCaptcha_Bad_Job_ID(
|
raise reCaptchaBadJobID(
|
||||||
'2Captcha: Error no job id was returned.'
|
'2Captcha: Error no job id was returned.'
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -198,7 +205,7 @@ class captchaSolver(reCaptcha):
|
|||||||
jobID = None
|
jobID = None
|
||||||
|
|
||||||
if not reCaptchaParams.get('api_key'):
|
if not reCaptchaParams.get('api_key'):
|
||||||
raise reCaptcha_exceptions.reCaptcha_Bad_Parameter(
|
raise reCaptchaParameter(
|
||||||
"2Captcha: Missing api_key parameter."
|
"2Captcha: Missing api_key parameter."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -215,11 +222,11 @@ class captchaSolver(reCaptcha):
|
|||||||
if jobID:
|
if jobID:
|
||||||
self.reportJob(jobID)
|
self.reportJob(jobID)
|
||||||
except polling.TimeoutException:
|
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)
|
"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)
|
"2Captcha: reCaptcha solve took to long to execute job id {}, aborting.".format(jobID)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,18 +2,23 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
import requests
|
import requests
|
||||||
import reCaptcha_exceptions
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import polling
|
import polling
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import sys
|
raise ImportError(
|
||||||
sys.tracebacklimit = 0
|
|
||||||
raise reCaptcha_exceptions.reCaptcha_Import_Error(
|
|
||||||
"Please install the python module 'polling' via pip or download it from "
|
"Please install the python module 'polling' via pip or download it from "
|
||||||
"https://github.com/justiniso/polling/"
|
"https://github.com/justiniso/polling/"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from ..exceptions import (
|
||||||
|
reCaptchaServiceUnavailable,
|
||||||
|
reCaptchaAPIError,
|
||||||
|
reCaptchaTimeout,
|
||||||
|
reCaptchaParameter,
|
||||||
|
reCaptchaBadJobID
|
||||||
|
)
|
||||||
|
|
||||||
from . import reCaptcha
|
from . import reCaptcha
|
||||||
|
|
||||||
|
|
||||||
@@ -30,7 +35,7 @@ class captchaSolver(reCaptcha):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def checkErrorStatus(response):
|
def checkErrorStatus(response):
|
||||||
if response.status_code in [500, 502]:
|
if response.status_code in [500, 502]:
|
||||||
raise reCaptcha_exceptions.reCaptcha_Service_Unavailable(
|
raise reCaptchaServiceUnavailable(
|
||||||
'9kw: Server Side Error {}'.format(response.status_code)
|
'9kw: Server Side Error {}'.format(response.status_code)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -93,17 +98,17 @@ class captchaSolver(reCaptcha):
|
|||||||
|
|
||||||
if response.text.startswith('{'):
|
if response.text.startswith('{'):
|
||||||
if response.json().get('error'):
|
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:
|
else:
|
||||||
error_code = int(re.search(r'^00(?P<error_code>\d+)', response.text).groupdict().get('error_code', 0))
|
error_code = int(re.search(r'^00(?P<error_code>\d+)', response.text).groupdict().get('error_code', 0))
|
||||||
if error_code:
|
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):
|
def requestJob(self, jobID):
|
||||||
if not jobID:
|
if not jobID:
|
||||||
raise reCaptcha_exceptions.reCaptcha_Bad_Job_ID(
|
raise reCaptchaBadJobID(
|
||||||
"9kw: Error bad job id to request reCaptcha against."
|
"9kw: Error bad job id to request reCaptcha against."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -134,7 +139,7 @@ class captchaSolver(reCaptcha):
|
|||||||
if response:
|
if response:
|
||||||
return response.json().get('answer')
|
return response.json().get('answer')
|
||||||
else:
|
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:
|
if response:
|
||||||
return response.json().get('captchaid')
|
return response.json().get('captchaid')
|
||||||
else:
|
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
|
jobID = None
|
||||||
|
|
||||||
if not reCaptchaParams.get('api_key'):
|
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')
|
self.api_key = reCaptchaParams.get('api_key')
|
||||||
|
|
||||||
@@ -192,7 +197,7 @@ class captchaSolver(reCaptcha):
|
|||||||
jobID = self.requestSolve(site_url, site_key)
|
jobID = self.requestSolve(site_url, site_key)
|
||||||
return self.requestJob(jobID)
|
return self.requestJob(jobID)
|
||||||
except polling.TimeoutException:
|
except polling.TimeoutException:
|
||||||
raise reCaptcha_exceptions.reCaptcha_Timeout(
|
raise reCaptchaTimeout(
|
||||||
"9kw: reCaptcha solve took to long to execute 'captchaid' {}, aborting.".format(jobID)
|
"9kw: reCaptcha solve took to long to execute 'captchaid' {}, aborting.".format(jobID)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import sys
|
|
||||||
import logging
|
|
||||||
import abc
|
import abc
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
|
||||||
if sys.version_info >= (3, 4):
|
if sys.version_info >= (3, 4):
|
||||||
ABC = abc.ABC # noqa
|
ABC = abc.ABC # noqa
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import sys
|
from ..exceptions import reCaptchaParameter
|
||||||
import reCaptcha_exceptions
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from python_anticaptcha import AnticaptchaClient, NoCaptchaTaskProxylessTask
|
from python_anticaptcha import (
|
||||||
|
AnticaptchaClient,
|
||||||
|
NoCaptchaTaskProxylessTask
|
||||||
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
sys.tracebacklimit = 0
|
raise ImportError(
|
||||||
raise reCaptcha_exceptions.reCaptcha_Import_Error(
|
|
||||||
"Please install the python module 'python_anticaptcha' via pip or download it from "
|
"Please install the python module 'python_anticaptcha' via pip or download it from "
|
||||||
"https://github.com/ad-m/python-anticaptcha"
|
"https://github.com/ad-m/python-anticaptcha"
|
||||||
)
|
)
|
||||||
@@ -24,7 +25,7 @@ class captchaSolver(reCaptcha):
|
|||||||
|
|
||||||
def getCaptchaAnswer(self, site_url, site_key, reCaptchaParams):
|
def getCaptchaAnswer(self, site_url, site_key, reCaptchaParams):
|
||||||
if not reCaptchaParams.get('api_key'):
|
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'))
|
client = AnticaptchaClient(reCaptchaParams.get('api_key'))
|
||||||
|
|
||||||
@@ -34,9 +35,9 @@ class captchaSolver(reCaptcha):
|
|||||||
task = NoCaptchaTaskProxylessTask(site_url, site_key)
|
task = NoCaptchaTaskProxylessTask(site_url, site_key)
|
||||||
|
|
||||||
if not hasattr(client, 'createTaskSmee'):
|
if not hasattr(client, 'createTaskSmee'):
|
||||||
sys.tracebacklimit = 0
|
raise NotImplementedError(
|
||||||
raise reCaptcha_exceptions.reCaptcha_Import_Error(
|
"Please upgrade 'python_anticaptcha' via pip or download it from "
|
||||||
"Please upgrade 'python_anticaptcha' via pip or download it from https://github.com/ad-m/python-anticaptcha"
|
"https://github.com/ad-m/python-anticaptcha"
|
||||||
)
|
)
|
||||||
|
|
||||||
job = client.createTaskSmee(task)
|
job = client.createTaskSmee(task)
|
||||||
|
|||||||
@@ -2,18 +2,24 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
import reCaptcha_exceptions
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import polling
|
import polling
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import sys
|
raise ImportError(
|
||||||
sys.tracebacklimit = 0
|
|
||||||
raise reCaptcha_exceptions.reCaptcha_Import_Error(
|
|
||||||
"Please install the python module 'polling' via pip or download it from "
|
"Please install the python module 'polling' via pip or download it from "
|
||||||
"https://github.com/justiniso/polling/"
|
"https://github.com/justiniso/polling/"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from ..exceptions import (
|
||||||
|
reCaptchaServiceUnavailable,
|
||||||
|
reCaptchaAccountError,
|
||||||
|
reCaptchaTimeout,
|
||||||
|
reCaptchaParameter,
|
||||||
|
reCaptchaBadJobID,
|
||||||
|
reCaptchaReportError
|
||||||
|
)
|
||||||
|
|
||||||
from . import reCaptcha
|
from . import reCaptcha
|
||||||
|
|
||||||
|
|
||||||
@@ -38,7 +44,7 @@ class captchaSolver(reCaptcha):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if response.status_code in errors:
|
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):
|
def _checkRequest(response):
|
||||||
if response.ok:
|
if response.ok:
|
||||||
if response.json().get('is_banned'):
|
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:
|
if response.json().get('balanace') == 0:
|
||||||
raise reCaptcha_exceptions.reCaptcha_Account_Error('DeathByCaptcha: insufficient credits.')
|
raise reCaptchaAccountError('DeathByCaptcha: insufficient credits.')
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@@ -80,7 +86,7 @@ class captchaSolver(reCaptcha):
|
|||||||
|
|
||||||
def reportJob(self, jobID):
|
def reportJob(self, jobID):
|
||||||
if not jobID:
|
if not jobID:
|
||||||
raise reCaptcha_exceptions.reCaptcha_Bad_Job_ID(
|
raise reCaptchaBadJobID(
|
||||||
"DeathByCaptcha: Error bad job id to report failed reCaptcha."
|
"DeathByCaptcha: Error bad job id to report failed reCaptcha."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -109,7 +115,7 @@ class captchaSolver(reCaptcha):
|
|||||||
if response:
|
if response:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
raise reCaptcha_exceptions.reCaptcha_Report_Error(
|
raise reCaptchaReportError(
|
||||||
"DeathByCaptcha: Error report failed reCaptcha."
|
"DeathByCaptcha: Error report failed reCaptcha."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -117,7 +123,7 @@ class captchaSolver(reCaptcha):
|
|||||||
|
|
||||||
def requestJob(self, jobID):
|
def requestJob(self, jobID):
|
||||||
if not jobID:
|
if not jobID:
|
||||||
raise reCaptcha_exceptions.reCaptcha_Bad_Job_ID(
|
raise reCaptchaBadJobID(
|
||||||
"DeathByCaptcha: Error bad job id to request reCaptcha."
|
"DeathByCaptcha: Error bad job id to request reCaptcha."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -142,7 +148,7 @@ class captchaSolver(reCaptcha):
|
|||||||
if response:
|
if response:
|
||||||
return response.json().get('text')
|
return response.json().get('text')
|
||||||
else:
|
else:
|
||||||
raise reCaptcha_exceptions.reCaptcha_Timeout(
|
raise reCaptchaTimeout(
|
||||||
"DeathByCaptcha: Error failed to solve reCaptcha."
|
"DeathByCaptcha: Error failed to solve reCaptcha."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -180,7 +186,7 @@ class captchaSolver(reCaptcha):
|
|||||||
if response:
|
if response:
|
||||||
return response.json().get('captcha')
|
return response.json().get('captcha')
|
||||||
else:
|
else:
|
||||||
raise reCaptcha_exceptions.reCaptcha_Bad_Job_ID(
|
raise reCaptchaBadJobID(
|
||||||
'DeathByCaptcha: Error no job id was returned.'
|
'DeathByCaptcha: Error no job id was returned.'
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -191,7 +197,7 @@ class captchaSolver(reCaptcha):
|
|||||||
|
|
||||||
for param in ['username', 'password']:
|
for param in ['username', 'password']:
|
||||||
if not reCaptchaParams.get(param):
|
if not reCaptchaParams.get(param):
|
||||||
raise reCaptcha_exceptions.reCaptcha_Bad_Parameter(
|
raise reCaptchaParameter(
|
||||||
"DeathByCaptcha: Missing '{}' parameter.".format(param)
|
"DeathByCaptcha: Missing '{}' parameter.".format(param)
|
||||||
)
|
)
|
||||||
setattr(self, param, reCaptchaParams.get(param))
|
setattr(self, param, reCaptchaParams.get(param))
|
||||||
@@ -207,11 +213,11 @@ class captchaSolver(reCaptcha):
|
|||||||
if jobID:
|
if jobID:
|
||||||
self.reportJob(jobID)
|
self.reportJob(jobID)
|
||||||
except polling.TimeoutException:
|
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)
|
"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)
|
"DeathByCaptcha: reCaptcha solve took to long to execute job id {}, aborting.".format(jobID)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -84,8 +84,8 @@ class User_Agent():
|
|||||||
if not self.tryMatchCustom(user_agents):
|
if not self.tryMatchCustom(user_agents):
|
||||||
self.cipherSuite = [
|
self.cipherSuite = [
|
||||||
ssl._DEFAULT_CIPHERS,
|
ssl._DEFAULT_CIPHERS,
|
||||||
'!ECDHE+SHA',
|
'!AES128-SHA',
|
||||||
'!AES128-SHA'
|
'!ECDHE-RSA-AES256-SHA',
|
||||||
]
|
]
|
||||||
self.headers = OrderedDict([
|
self.headers = OrderedDict([
|
||||||
('User-Agent', self.custom),
|
('User-Agent', self.custom),
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
"ECDHE-RSA-AES256-GCM-SHA384",
|
"ECDHE-RSA-AES256-GCM-SHA384",
|
||||||
"ECDHE-ECDSA-CHACHA20-POLY1305",
|
"ECDHE-ECDSA-CHACHA20-POLY1305",
|
||||||
"ECDHE-RSA-CHACHA20-POLY1305",
|
"ECDHE-RSA-CHACHA20-POLY1305",
|
||||||
"ECDHE-RSA-AES256-SHA",
|
|
||||||
"AES128-GCM-SHA256",
|
"AES128-GCM-SHA256",
|
||||||
"AES256-GCM-SHA384",
|
"AES256-GCM-SHA384",
|
||||||
"AES128-SHA",
|
"AES128-SHA",
|
||||||
@@ -12824,7 +12823,6 @@
|
|||||||
"ECDHE-RSA-AES256-GCM-SHA384",
|
"ECDHE-RSA-AES256-GCM-SHA384",
|
||||||
"ECDHE-ECDSA-AES256-SHA",
|
"ECDHE-ECDSA-AES256-SHA",
|
||||||
"ECDHE-ECDSA-AES128-SHA",
|
"ECDHE-ECDSA-AES128-SHA",
|
||||||
"ECDHE-RSA-AES256-SHA",
|
|
||||||
"DHE-RSA-AES128-SHA",
|
"DHE-RSA-AES128-SHA",
|
||||||
"DHE-RSA-AES256-SHA",
|
"DHE-RSA-AES256-SHA",
|
||||||
"AES128-SHA",
|
"AES128-SHA",
|
||||||
|
|||||||
+7
-6
@@ -35,13 +35,14 @@ class UnshortenIt(object):
|
|||||||
_anonymz_regex = r'anonymz\.com'
|
_anonymz_regex = r'anonymz\.com'
|
||||||
_shrink_service_regex = r'shrink-service\.it'
|
_shrink_service_regex = r'shrink-service\.it'
|
||||||
_rapidcrypt_regex = r'rapidcrypt\.net'
|
_rapidcrypt_regex = r'rapidcrypt\.net'
|
||||||
_cryptmango_regex = r'cryptmango|xshield\.net'
|
|
||||||
_vcrypt_regex = r'vcrypt\.net|vcrypt\.pw'
|
_vcrypt_regex = r'vcrypt\.net|vcrypt\.pw'
|
||||||
_linkup_regex = r'linkup\.pro|buckler.link'
|
_linkup_regex = r'linkup\.pro|buckler.link'
|
||||||
_linkhub_regex = r'linkhub\.icu'
|
_linkhub_regex = r'linkhub\.icu'
|
||||||
|
# for services that only include real link inside iframe
|
||||||
|
_simple_iframe_regex = r'cryptmango|xshield\.net|vcrypt\.club'
|
||||||
|
|
||||||
listRegex = [_adfly_regex, _linkbucks_regex, _adfocus_regex, _lnxlu_regex, _shst_regex, _hrefli_regex, _anonymz_regex,
|
listRegex = [_adfly_regex, _linkbucks_regex, _adfocus_regex, _lnxlu_regex, _shst_regex, _hrefli_regex, _anonymz_regex,
|
||||||
_shrink_service_regex, _rapidcrypt_regex, _cryptmango_regex, _vcrypt_regex, _linkup_regex, _linkhub_regex]
|
_shrink_service_regex, _rapidcrypt_regex, _simple_iframe_regex, _vcrypt_regex, _linkup_regex, _linkhub_regex]
|
||||||
|
|
||||||
_maxretries = 5
|
_maxretries = 5
|
||||||
|
|
||||||
@@ -79,8 +80,8 @@ class UnshortenIt(object):
|
|||||||
uri, code = self._unshorten_anonymz(uri)
|
uri, code = self._unshorten_anonymz(uri)
|
||||||
if re.search(self._rapidcrypt_regex, domain, re.IGNORECASE):
|
if re.search(self._rapidcrypt_regex, domain, re.IGNORECASE):
|
||||||
uri, code = self._unshorten_rapidcrypt(uri)
|
uri, code = self._unshorten_rapidcrypt(uri)
|
||||||
if re.search(self._cryptmango_regex, uri, re.IGNORECASE):
|
if re.search(self._simple_iframe_regex, uri, re.IGNORECASE):
|
||||||
uri, code = self._unshorten_cryptmango(uri)
|
uri, code = self._unshorten_simple_iframe(uri)
|
||||||
if re.search(self._vcrypt_regex, uri, re.IGNORECASE):
|
if re.search(self._vcrypt_regex, uri, re.IGNORECASE):
|
||||||
uri, code = self._unshorten_vcrypt(uri)
|
uri, code = self._unshorten_vcrypt(uri)
|
||||||
if re.search(self._linkup_regex, uri, re.IGNORECASE):
|
if re.search(self._linkup_regex, uri, re.IGNORECASE):
|
||||||
@@ -467,12 +468,12 @@ class UnshortenIt(object):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return uri, 0
|
return uri, 0
|
||||||
|
|
||||||
def _unshorten_cryptmango(self, uri):
|
def _unshorten_simple_iframe(self, uri):
|
||||||
try:
|
try:
|
||||||
r = httptools.downloadpage(uri, timeout=self._timeout, cookies=False)
|
r = httptools.downloadpage(uri, timeout=self._timeout, cookies=False)
|
||||||
html = r.data
|
html = r.data
|
||||||
|
|
||||||
uri = re.findall(r'<iframe src="([^"]+)"[^>]+>', html)[0]
|
uri = re.findall(r'<iframe\s+src="([^"]+)', html)[0]
|
||||||
|
|
||||||
return uri, r.code
|
return uri, r.code
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user