aggiornati cloudscraper e i link dei canali, fixato guardaserie

This commit is contained in:
marco
2020-03-25 19:50:30 +01:00
parent cd1ea3a76e
commit 97c12e3f11
14 changed files with 108 additions and 166 deletions

View File

@@ -17,22 +17,22 @@
"dreamsub": "https://dreamsub.stream",
"dsda": "https://www.dsda.press/",
"fastsubita": "https://fastsubita.online",
"filmgratis": "https://www.filmaltadefinizione.org",
"filmgratis": "https://www.filmaltadefinizione.tv",
"filmigratis": "https://filmigratis.org",
"filmsenzalimiticc": "https://www.filmsenzalimiti.tech",
"filmsenzalimiticc": "https://www.filmsenzalimiti.website",
"filmstreaming01": "https://filmstreaming01.com",
"guardaserie_stream": "https://guardaserie.store",
"guardaserieclick": "https://www.guardaserie.media",
"ilgeniodellostreaming": "https://ilgeniodellostreaming.ch",
"guardaserieclick": "https://www.guardaserie.productions",
"ilgeniodellostreaming": "https://ilgeniodellostreaming.pl",
"italiaserie": "https://italiaserie.org",
"mondoserietv": "https://mondoserietv.com",
"netfreex": "https://www.netfreex.pro",
"piratestreaming": "https://www.piratestreaming.digital",
"polpotv": "https://polpo.tv",
"piratestreaming": "https://www.piratestreaming.group",
"polpotv": "https://polpotv.club",
"pufimovies": "https://pufimovies.com",
"raiplay": "https://www.raiplay.it",
"seriehd": "https://www.seriehd.live",
"serietvonline": "https://serietvonline.kim",
"seriehd": "https://seriehd.life",
"serietvonline": "https://serietvonline.casa",
"serietvsubita": "http://serietvsubita.xyz",
"serietvu": "https://www.serietvu.link",
"streamtime": "https://t.me/s/StreamTime",

View File

@@ -61,7 +61,7 @@ def hdpass_get_servers(item):
url = url.replace("&download=1", "")
if 'hdpass' not in url and 'hdplayer' not in url:
return itemlist
if 'http' not in url:
if not url.startswith('http'):
url = 'https:' + url
data = httptools.downloadpage(url).data

View File

@@ -1,6 +1,4 @@
# https://github.com/VeNoMouS/cloudscraper/tree/master
import logging
import os
import re
import sys
import ssl
@@ -26,6 +24,14 @@ from collections import OrderedDict
from requests.sessions import Session
from requests.adapters import HTTPAdapter
from .exceptions import (
CloudflareLoopProtection,
CloudflareCode1020,
CloudflareIUAMError,
CloudflareReCaptchaError,
CloudflareReCaptchaProvider
)
from .interpreters import JavaScriptInterpreter
from .reCaptcha import reCaptcha
from .user_agent import User_Agent
@@ -45,13 +51,10 @@ try:
except ImportError:
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:
sys.tracebacklimit = 0
_ = self._solveDepthCnt
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(_)
)
@@ -301,7 +304,7 @@ class CloudScraper(Session):
def is_Challenge_Request(self, resp):
if self.is_Firewall_Blocked(resp):
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):
return True
@@ -323,7 +326,7 @@ class CloudScraper(Session):
except AttributeError:
sys.tracebacklimit = 0
raise cloudflare_exceptions.Cloudflare_Error_IUAM(
raise CloudflareIUAMError(
"Cloudflare IUAM detected, unfortunately we can't extract the parameters correctly."
)
@@ -334,7 +337,8 @@ class CloudScraper(Session):
interpreter
).solveChallenge(body, hostParsed.netloc)
except Exception as e:
raise cloudflare_exceptions.Cloudflare_Error_IUAM(
sys.tracebacklimit = 0
raise CloudflareIUAMError(
'Unable to parse Cloudflare anti-bots page: {}'.format(
getattr(e, 'message', e)
)
@@ -362,7 +366,7 @@ class CloudScraper(Session):
).groupdict()
except (AttributeError):
sys.tracebacklimit = 0
raise cloudflare_exceptions.Cloudflare_Error_reCaptcha(
raise CloudflareReCaptchaError(
"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'):
sys.tracebacklimit = 0
raise cloudflare_exceptions.Cloudflare_reCaptcha_Provider(
raise CloudflareReCaptchaProvider(
"Cloudflare reCaptcha detected, unfortunately you haven't loaded an anti reCaptcha provider "
"correctly via the 'recaptcha' parameter."
)
@@ -445,7 +449,7 @@ class CloudScraper(Session):
self.delay = delay
except (AttributeError, ValueError):
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)
@@ -584,7 +588,7 @@ class CloudScraper(Session):
break
else:
sys.tracebacklimit = 0
raise cloudflare_exceptions.Cloudflare_Error_IUAM(
raise CloudflareIUAMError(
"Unable to find Cloudflare cookies. Does the site actually "
"have Cloudflare IUAM (I'm Under Attack Mode) enabled?"
)

View File

@@ -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.
"""

View File

@@ -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.
"""

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

View File

@@ -84,8 +84,8 @@ class User_Agent():
if not self.tryMatchCustom(user_agents):
self.cipherSuite = [
ssl._DEFAULT_CIPHERS,
'!ECDHE+SHA',
'!AES128-SHA'
'!AES128-SHA',
'!ECDHE-RSA-AES256-SHA',
]
self.headers = OrderedDict([
('User-Agent', self.custom),

View File

@@ -17,7 +17,6 @@
"ECDHE-RSA-AES256-GCM-SHA384",
"ECDHE-ECDSA-CHACHA20-POLY1305",
"ECDHE-RSA-CHACHA20-POLY1305",
"ECDHE-RSA-AES256-SHA",
"AES128-GCM-SHA256",
"AES256-GCM-SHA384",
"AES128-SHA",
@@ -12824,7 +12823,6 @@
"ECDHE-RSA-AES256-GCM-SHA384",
"ECDHE-ECDSA-AES256-SHA",
"ECDHE-ECDSA-AES128-SHA",
"ECDHE-RSA-AES256-SHA",
"DHE-RSA-AES128-SHA",
"DHE-RSA-AES256-SHA",
"AES128-SHA",

View File

@@ -35,13 +35,14 @@ class UnshortenIt(object):
_anonymz_regex = r'anonymz\.com'
_shrink_service_regex = r'shrink-service\.it'
_rapidcrypt_regex = r'rapidcrypt\.net'
_cryptmango_regex = r'cryptmango|xshield\.net'
_vcrypt_regex = r'vcrypt\.net|vcrypt\.pw'
_linkup_regex = r'linkup\.pro|buckler.link'
_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,
_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
@@ -79,8 +80,8 @@ class UnshortenIt(object):
uri, code = self._unshorten_anonymz(uri)
if re.search(self._rapidcrypt_regex, domain, re.IGNORECASE):
uri, code = self._unshorten_rapidcrypt(uri)
if re.search(self._cryptmango_regex, uri, re.IGNORECASE):
uri, code = self._unshorten_cryptmango(uri)
if re.search(self._simple_iframe_regex, uri, re.IGNORECASE):
uri, code = self._unshorten_simple_iframe(uri)
if re.search(self._vcrypt_regex, uri, re.IGNORECASE):
uri, code = self._unshorten_vcrypt(uri)
if re.search(self._linkup_regex, uri, re.IGNORECASE):
@@ -467,12 +468,12 @@ class UnshortenIt(object):
except Exception as e:
return uri, 0
def _unshorten_cryptmango(self, uri):
def _unshorten_simple_iframe(self, uri):
try:
r = httptools.downloadpage(uri, timeout=self._timeout, cookies=False)
html = r.data
uri = re.findall(r'<iframe src="([^"]+)"[^>]+>', html)[0]
uri = re.findall(r'<iframe\s+src="([^"]+)', html)[0]
return uri, r.code