DooD Stream, Fix Kodi 18
This commit is contained in:
@@ -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)
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------------------- #
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user