From abf92a832f3eb0a7c9ddb2ed27ec183d129ac405 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Tue, 1 Jun 2021 09:18:58 +0200 Subject: [PATCH] DooD Stream, Fix Kodi 18 --- lib/cloudscraper/__init__.py | 24 +++++++++++----------- lib/cloudscraper/captcha/2captcha.py | 6 +++--- lib/cloudscraper/captcha/9kw.py | 2 +- lib/cloudscraper/captcha/__init__.py | 4 ++-- lib/cloudscraper/captcha/capmonster.py | 6 +++--- lib/cloudscraper/captcha/deathbycaptcha.py | 8 ++++---- lib/cloudscraper/help.py | 4 ++-- lib/cloudscraper/user_agent/__init__.py | 6 +++--- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/lib/cloudscraper/__init__.py b/lib/cloudscraper/__init__.py index 07774703..98e7d51e 100644 --- a/lib/cloudscraper/__init__.py +++ b/lib/cloudscraper/__init__.py @@ -199,7 +199,7 @@ class CloudScraper(Session): try: print(dump.dump_all(req).decode('utf-8', errors='backslashreplace')) except ValueError as e: - print(f"Debug Error: {getattr(e, 'message', e)}") + print("Debug Error: {}".format(getattr(e, 'message', e))) # ------------------------------------------------------------------------------- # # Unescape / decode html entities @@ -225,10 +225,10 @@ class CloudScraper(Session): resp._content = brotli.decompress(resp.content) else: logging.warning( - f'You\'re running urllib3 {requests.packages.urllib3.__version__}, Brotli content detected, ' + 'You\'re running urllib3 {}, Brotli content detected, ' 'Which requires manual decompression, ' 'But option allow_brotli is set to False, ' - 'We will not continue to decompress.' + 'We will not continue to decompress.'.format(requests.packages.urllib3.__version__) ) return resp @@ -290,7 +290,7 @@ class CloudScraper(Session): _ = self._solveDepthCnt self.simpleException( CloudflareLoopProtection, - f"!!Loop Protection!! We have tried to solve {_} time(s) in a row." + "!!Loop Protection!! We have tried to solve {} time(s) in a row.".format(_) ) self._solveDepthCnt += 1 @@ -500,11 +500,11 @@ class CloudScraper(Session): except Exception as e: self.simpleException( CloudflareIUAMError, - f"Unable to parse Cloudflare anti-bots page: {getattr(e, 'message', e)}" + "Unable to parse Cloudflare anti-bots page: {}".format(getattr(e, 'message', e)) ) return { - 'url': f"{hostParsed.scheme}://{hostParsed.netloc}{self.unescape(formPayload['challengeUUID'])}", + 'url': "{}://{}{}".format(hostParsed.scheme, hostParsed.netloc, self.unescape(formPayload['challengeUUID'])), 'data': payload } @@ -585,7 +585,7 @@ class CloudScraper(Session): hostParsed = urlparse(url) return { - 'url': f"{hostParsed.scheme}://{hostParsed.netloc}{self.unescape(formPayload['challengeUUID'])}", + 'url': "{}://{}{}".format(hostParsed.scheme, hostParsed.netloc, self.unescape(formPayload['challengeUUID'])), 'data': dataPayload } @@ -695,7 +695,7 @@ class CloudScraper(Session): cloudflare_kwargs, 'headers', { - 'Origin': f'{urlParsed.scheme}://{urlParsed.netloc}', + 'Origin': '{}://{}'.format(urlParsed.scheme, urlParsed.netloc), 'Referer': resp.url } ) @@ -793,7 +793,7 @@ class CloudScraper(Session): resp = scraper.get(url, **kwargs) resp.raise_for_status() except Exception: - logging.error(f'"{url}" returned an error. Could not collect tokens.') + logging.error('"{}" returned an error. Could not collect tokens.'.format(url)) raise domain = urlparse(resp.url).netloc @@ -801,7 +801,7 @@ class CloudScraper(Session): cookie_domain = None for d in scraper.cookies.list_domains(): - if d.startswith('.') and d in (f'.{domain}'): + if d.startswith('.') and d in ('.{}'.format(domain)): cookie_domain = d break else: @@ -834,9 +834,9 @@ class CloudScraper(Session): if ssl.OPENSSL_VERSION_INFO < (1, 1, 1): print( - f"DEPRECATION: The OpenSSL being used by this python install ({ssl.OPENSSL_VERSION}) does not meet the minimum supported " + "DEPRECATION: The OpenSSL being used by this python install ({}) does not meet the minimum supported " "version (>= OpenSSL 1.1.1) in order to support TLS 1.3 required by Cloudflare, " - "You may encounter an unexpected Captcha or cloudflare 1020 blocks." + "You may encounter an unexpected Captcha or cloudflare 1020 blocks.".format(ssl.OPENSSL_VERSION) ) # ------------------------------------------------------------------------------- # diff --git a/lib/cloudscraper/captcha/2captcha.py b/lib/cloudscraper/captcha/2captcha.py index 7fae7f30..42adb220 100644 --- a/lib/cloudscraper/captcha/2captcha.py +++ b/lib/cloudscraper/captcha/2captcha.py @@ -103,7 +103,7 @@ class captchaSolver(Captcha): response = polling2.poll( lambda: self.session.get( - f'{self.host}/res.php', + '{}/res.php'.format(self.host), params={ 'key': self.api_key, 'action': 'reportbad', @@ -138,7 +138,7 @@ class captchaSolver(Captcha): response = polling2.poll( lambda: self.session.get( - f'{self.host}/res.php', + '{}/res.php'.format(self.host), params={ 'key': self.api_key, 'action': 'get', @@ -195,7 +195,7 @@ class captchaSolver(Captcha): response = polling2.poll( lambda: self.session.post( - f'{self.host}/in.php', + '{}/in.php'.format(self.host), data=data, allow_redirects=False, timeout=30 diff --git a/lib/cloudscraper/captcha/9kw.py b/lib/cloudscraper/captcha/9kw.py index 143def81..c737d0f3 100644 --- a/lib/cloudscraper/captcha/9kw.py +++ b/lib/cloudscraper/captcha/9kw.py @@ -36,7 +36,7 @@ class captchaSolver(reCaptcha): def checkErrorStatus(response): if response.status_code in [500, 502]: raise reCaptchaServiceUnavailable( - f'9kw: Server Side Error {response.status_code}' + '9kw: Server Side Error {}'.format(response.status_code) ) error_codes = { diff --git a/lib/cloudscraper/captcha/__init__.py b/lib/cloudscraper/captcha/__init__.py index 63a58aa5..9acc37f7 100644 --- a/lib/cloudscraper/captcha/__init__.py +++ b/lib/cloudscraper/captcha/__init__.py @@ -25,12 +25,12 @@ class Captcha(ABC): def dynamicImport(cls, name): if name not in captchaSolvers: try: - __import__(f'{cls.__module__}.{name}') + __import__('{}.{}'.format(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(f'Unable to load {name} anti captcha provider -> {e}') + logging.error('Unable to load {} anti captcha provider -> {}'.format(name, e)) raise return captchaSolvers[name] diff --git a/lib/cloudscraper/captcha/capmonster.py b/lib/cloudscraper/captcha/capmonster.py index 9e636106..4b7722b8 100644 --- a/lib/cloudscraper/captcha/capmonster.py +++ b/lib/cloudscraper/captcha/capmonster.py @@ -36,7 +36,7 @@ class captchaSolver(Captcha): def checkErrorStatus(response): if response.status_code in [500, 502]: raise CaptchaServiceUnavailable( - f'CapMonster: Server Side Error {response.status_code}' + 'CapMonster: Server Side Error {}'.format(response.status_code) ) payload = response.json() @@ -66,7 +66,7 @@ class captchaSolver(Captcha): response = polling2.poll( lambda: self.session.post( - f'{self.host}/getTaskResult', + '{}/getTaskResult'.format(self.host), json={ 'clientKey': self.clientKey, 'taskId': taskID @@ -113,7 +113,7 @@ class captchaSolver(Captcha): response = polling2.poll( lambda: self.session.post( - f'{self.host}/createTask', + '{}/createTask'.format(self.host), json=data, allow_redirects=False, timeout=30 diff --git a/lib/cloudscraper/captcha/deathbycaptcha.py b/lib/cloudscraper/captcha/deathbycaptcha.py index 33c5ef2d..15b39f3a 100644 --- a/lib/cloudscraper/captcha/deathbycaptcha.py +++ b/lib/cloudscraper/captcha/deathbycaptcha.py @@ -68,7 +68,7 @@ class captchaSolver(Captcha): response = polling2.poll( lambda: self.session.post( - f'{self.host}/user', + '{}/user'.format(self.host), headers={'Accept': 'application/json'}, data={ 'username': self.username, @@ -100,7 +100,7 @@ class captchaSolver(Captcha): response = polling2.poll( lambda: self.session.post( - f'{self.host}/captcha/{jobID}/report', + '{}/captcha/{}/report'.format(self.host, jobID), headers={'Accept': 'application/json'}, data={ 'username': self.username, @@ -137,7 +137,7 @@ class captchaSolver(Captcha): response = polling2.poll( lambda: self.session.get( - f'{self.host}/captcha/{jobID}', + '{}/captcha/{}'.format(self.host, jobID), headers={'Accept': 'application/json'} ), check_success=_checkRequest, @@ -203,7 +203,7 @@ class captchaSolver(Captcha): response = polling2.poll( lambda: self.session.post( - f'{self.host}/captcha', + '{}/captcha'.format(self.host), headers={'Accept': 'application/json'}, data=data, allow_redirects=False diff --git a/lib/cloudscraper/help.py b/lib/cloudscraper/help.py index 46aaf36c..b1599691 100644 --- a/lib/cloudscraper/help.py +++ b/lib/cloudscraper/help.py @@ -28,9 +28,9 @@ def _pythonVersion(): if interpreter == 'PyPy': interpreter_version = \ - f'{sys.pypy_version_info.major}.{sys.pypy_version_info.minor}.{sys.pypy_version_info.micro}' + '{}.{}.{}'.format(sys.pypy_version_info.major, sys.pypy_version_info.minor, sys.pypy_version_info.micro) if sys.pypy_version_info.releaselevel != 'final': - interpreter_version = f'{interpreter_version}{sys.pypy_version_info.releaselevel}' + interpreter_version = '{}{}'.format(interpreter_version, sys.pypy_version_info.releaselevel) return { 'name': interpreter, 'version': interpreter_version diff --git a/lib/cloudscraper/user_agent/__init__.py b/lib/cloudscraper/user_agent/__init__.py index cb6fd0a6..700ab8b5 100644 --- a/lib/cloudscraper/user_agent/__init__.py +++ b/lib/cloudscraper/user_agent/__init__.py @@ -93,14 +93,14 @@ class User_Agent(): else: if self.browser and self.browser not in self.browsers: sys.tracebacklimit = 0 - raise RuntimeError(f'Sorry "{self.browser}" browser is not valid, valid browsers are [{", ".join(self.browsers)}].') + raise RuntimeError('Sorry "{}" browser is not valid, valid browsers are [{}].'.format(self.browser), ", ".join(self.browsers)) if not self.platform: self.platform = random.SystemRandom().choice(self.platforms) if self.platform not in self.platforms: sys.tracebacklimit = 0 - raise RuntimeError(f'Sorry the platform "{self.platform}" is not valid, valid platforms are [{", ".join(self.platforms)}]') + raise RuntimeError('Sorry the platform "{}" is not valid, valid platforms are [{)}]'.format(self.platform, ", ".join(self.platforms))) filteredAgents = self.filterAgents(user_agents['user_agents']) @@ -111,7 +111,7 @@ class User_Agent(): if not filteredAgents[self.browser]: sys.tracebacklimit = 0 - raise RuntimeError(f'Sorry "{self.browser}" browser was not found with a platform of "{self.platform}".') + raise RuntimeError('Sorry "{}" browser was not found with a platform of "{}".'.format(self.browser, self.platform)) self.cipherSuite = user_agents['cipherSuite'][self.browser] self.headers = user_agents['headers'][self.browser]