mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 06:10:12 +01:00
parent
54a63e80af
commit
7814c50948
|
@ -72,7 +72,7 @@ dev = [
|
||||||
]
|
]
|
||||||
static-analysis = [
|
static-analysis = [
|
||||||
"autopep8~=2.0",
|
"autopep8~=2.0",
|
||||||
"ruff~=0.4.4",
|
"ruff~=0.5.0",
|
||||||
]
|
]
|
||||||
test = [
|
test = [
|
||||||
"pytest~=8.1",
|
"pytest~=8.1",
|
||||||
|
@ -211,6 +211,7 @@ ignore = [
|
||||||
"TD002", # missing-todo-author
|
"TD002", # missing-todo-author
|
||||||
"TD003", # missing-todo-link
|
"TD003", # missing-todo-link
|
||||||
"PLE0604", # invalid-all-object (false positives)
|
"PLE0604", # invalid-all-object (false positives)
|
||||||
|
"PLE0643", # potential-index-error (false positives)
|
||||||
"PLW0603", # global-statement
|
"PLW0603", # global-statement
|
||||||
"PLW1510", # subprocess-run-without-check
|
"PLW1510", # subprocess-run-without-check
|
||||||
"PLW2901", # redefined-loop-name
|
"PLW2901", # redefined-loop-name
|
||||||
|
|
|
@ -33,14 +33,6 @@ class AtresPlayerIE(InfoExtractor):
|
||||||
]
|
]
|
||||||
_API_BASE = 'https://api.atresplayer.com/'
|
_API_BASE = 'https://api.atresplayer.com/'
|
||||||
|
|
||||||
def _handle_error(self, e, code):
|
|
||||||
if isinstance(e.cause, HTTPError) and e.cause.status == code:
|
|
||||||
error = self._parse_json(e.cause.response.read(), None)
|
|
||||||
if error.get('error') == 'required_registered':
|
|
||||||
self.raise_login_required()
|
|
||||||
raise ExtractorError(error['error_description'], expected=True)
|
|
||||||
raise
|
|
||||||
|
|
||||||
def _perform_login(self, username, password):
|
def _perform_login(self, username, password):
|
||||||
self._request_webpage(
|
self._request_webpage(
|
||||||
self._API_BASE + 'login', None, 'Downloading login page')
|
self._API_BASE + 'login', None, 'Downloading login page')
|
||||||
|
@ -55,7 +47,9 @@ def _perform_login(self, username, password):
|
||||||
'password': password,
|
'password': password,
|
||||||
}))['targetUrl']
|
}))['targetUrl']
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
self._handle_error(e, 400)
|
if isinstance(e.cause, HTTPError) and e.cause.status == 400:
|
||||||
|
raise ExtractorError('Invalid username and/or password', expected=True)
|
||||||
|
raise
|
||||||
|
|
||||||
self._request_webpage(target_url, None, 'Following Target URL')
|
self._request_webpage(target_url, None, 'Following Target URL')
|
||||||
|
|
||||||
|
@ -66,7 +60,12 @@ def _real_extract(self, url):
|
||||||
episode = self._download_json(
|
episode = self._download_json(
|
||||||
self._API_BASE + 'client/v1/player/episode/' + video_id, video_id)
|
self._API_BASE + 'client/v1/player/episode/' + video_id, video_id)
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
self._handle_error(e, 403)
|
if isinstance(e.cause, HTTPError) and e.cause.status == 403:
|
||||||
|
error = self._parse_json(e.cause.response.read(), None)
|
||||||
|
if error.get('error') == 'required_registered':
|
||||||
|
self.raise_login_required()
|
||||||
|
raise ExtractorError(error['error_description'], expected=True)
|
||||||
|
raise
|
||||||
|
|
||||||
title = episode['titulo']
|
title = episode['titulo']
|
||||||
|
|
||||||
|
|
|
@ -455,10 +455,8 @@ def _get_claims_token_expiry(self):
|
||||||
|
|
||||||
def claims_token_expired(self):
|
def claims_token_expired(self):
|
||||||
exp = self._get_claims_token_expiry()
|
exp = self._get_claims_token_expiry()
|
||||||
if exp - time.time() < 10:
|
|
||||||
# It will expire in less than 10 seconds, or has already expired
|
# It will expire in less than 10 seconds, or has already expired
|
||||||
return True
|
return exp - time.time() < 10
|
||||||
return False
|
|
||||||
|
|
||||||
def claims_token_valid(self):
|
def claims_token_valid(self):
|
||||||
return self._claims_token is not None and not self.claims_token_expired()
|
return self._claims_token is not None and not self.claims_token_expired()
|
||||||
|
|
|
@ -667,12 +667,12 @@ def eval_method():
|
||||||
self.interpret_expression(v, local_vars, allow_recursion)
|
self.interpret_expression(v, local_vars, allow_recursion)
|
||||||
for v in self._separate(arg_str)]
|
for v in self._separate(arg_str)]
|
||||||
|
|
||||||
if obj == str:
|
if obj is str:
|
||||||
if member == 'fromCharCode':
|
if member == 'fromCharCode':
|
||||||
assertion(argvals, 'takes one or more arguments')
|
assertion(argvals, 'takes one or more arguments')
|
||||||
return ''.join(map(chr, argvals))
|
return ''.join(map(chr, argvals))
|
||||||
raise self.Exception(f'Unsupported String method {member}', expr)
|
raise self.Exception(f'Unsupported String method {member}', expr)
|
||||||
elif obj == float:
|
elif obj is float:
|
||||||
if member == 'pow':
|
if member == 'pow':
|
||||||
assertion(len(argvals) == 2, 'takes two arguments')
|
assertion(len(argvals) == 2, 'takes two arguments')
|
||||||
return argvals[0] ** argvals[1]
|
return argvals[0] ** argvals[1]
|
||||||
|
|
|
@ -230,9 +230,7 @@ class Urllib3LoggingFilter(logging.Filter):
|
||||||
|
|
||||||
def filter(self, record):
|
def filter(self, record):
|
||||||
# Ignore HTTP request messages since HTTPConnection prints those
|
# Ignore HTTP request messages since HTTPConnection prints those
|
||||||
if record.msg == '%s://%s:%s "%s %s %s" %s %s':
|
return record.msg != '%s://%s:%s "%s %s %s" %s %s'
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class Urllib3LoggingHandler(logging.Handler):
|
class Urllib3LoggingHandler(logging.Handler):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user