Flake8
This commit is contained in:
parent
bcc4698ebe
commit
11ba372e37
@ -17,11 +17,14 @@ except ImportError:
|
|||||||
|
|
||||||
|
|
||||||
class AtresPlayerIE(InfoExtractor):
|
class AtresPlayerIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?atresplayer\.com/[^/]+/[^/]+/[^/]+/[^/]+/[^/_]+_(?P<id>[A-z0-9]+)/?'
|
_VALID_URL = r'https?://(?:www\.)?atresplayer\.com/[^/]+/[^/]+/' \
|
||||||
|
r'[^/]+/[^/]+/[^/_]+_(?P<id>[A-z0-9]+)/?'
|
||||||
_NETRC_MACHINE = 'atresplayer'
|
_NETRC_MACHINE = 'atresplayer'
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
'url': 'https://www.atresplayer.com/lasexta/programas/el-intermedio/temporada-12/el-intermedio-21-05-18_5b03068d7ed1a8a94b3faf29/',
|
'url': 'https://www.atresplayer.com/lasexta/programas/el-'
|
||||||
|
'intermedio/temporada-12/el-intermedio-21-05-18_'
|
||||||
|
'5b03068d7ed1a8a94b3faf29/',
|
||||||
'md5': '3afa3d3cc155264374916f2a23d1d00c',
|
'md5': '3afa3d3cc155264374916f2a23d1d00c',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '5b03068d7ed1a8a94b3faf29',
|
'id': '5b03068d7ed1a8a94b3faf29',
|
||||||
@ -33,14 +36,19 @@ class AtresPlayerIE(InfoExtractor):
|
|||||||
'skip': 'required_registered',
|
'skip': 'required_registered',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'url': 'http://www.atresplayer.com/television/series/el-secreto-de-puente-viejo/el-chico-de-los-tres-lunares/capitulo-977-29-12-14_2014122400174.html',
|
'url': 'http://www.atresplayer.com/television/series/'
|
||||||
|
'el-secreto-de-puente-viejo/el-chico-de-los-'
|
||||||
|
'tres-lunares/capitulo-977-29-12-14_'
|
||||||
|
'2014122400174.html',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
_USER_AGENT = 'Dalvik/1.6.0 (Linux; U; Android 4.3; GT-I9300 Build/JSS15J'
|
_USER_AGENT = 'Dalvik/1.6.0 (Linux; U; Android 4.3; GT-I9300 Build/JSS15J'
|
||||||
_PLAYER_URL_TEMPLATE = 'https://api.atresplayer.com/client/v1/page/episode/%s'
|
_PLAYER_URL_TEMPLATE = 'https://api.atresplayer.com/client/v1/page/' \
|
||||||
_LOGIN_URL = 'https://api.atresplayer.com/login?redirect=https%3A%2F%2Fwww.atresplayer.com'
|
'episode/%s'
|
||||||
|
_LOGIN_URL = 'https://api.atresplayer.com/login?redirect=https%3A%2F%2F' \
|
||||||
|
'www.atresplayer.com'
|
||||||
_LOGIN_ACCOUNT_URL = 'https://account.atresmedia.com/api/login'
|
_LOGIN_ACCOUNT_URL = 'https://account.atresmedia.com/api/login'
|
||||||
|
|
||||||
def _real_initialize(self):
|
def _real_initialize(self):
|
||||||
@ -73,7 +81,8 @@ class AtresPlayerIE(InfoExtractor):
|
|||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
self._download_webpage(response['targetUrl'], None, 'Set login session')
|
self._download_webpage(response['targetUrl'], None,
|
||||||
|
'Set login session')
|
||||||
|
|
||||||
def _atres_player_error(self, body_response, original_exception):
|
def _atres_player_error(self, body_response, original_exception):
|
||||||
try:
|
try:
|
||||||
@ -82,7 +91,8 @@ class AtresPlayerIE(InfoExtractor):
|
|||||||
return original_exception
|
return original_exception
|
||||||
if isinstance(data, dict) and 'error' in data:
|
if isinstance(data, dict) and 'error' in data:
|
||||||
return ExtractorError('{} returned error: {} ({})'.format(
|
return ExtractorError('{} returned error: {} ({})'.format(
|
||||||
self.IE_NAME, data['error'], data.get('error_description', 'There is no description')
|
self.IE_NAME, data['error'], data.get(
|
||||||
|
'error_description', 'There is no description')
|
||||||
), expected=True)
|
), expected=True)
|
||||||
else:
|
else:
|
||||||
return original_exception
|
return original_exception
|
||||||
@ -93,7 +103,8 @@ class AtresPlayerIE(InfoExtractor):
|
|||||||
request = sanitized_Request(
|
request = sanitized_Request(
|
||||||
self._PLAYER_URL_TEMPLATE % video_id,
|
self._PLAYER_URL_TEMPLATE % video_id,
|
||||||
headers={'User-Agent': self._USER_AGENT})
|
headers={'User-Agent': self._USER_AGENT})
|
||||||
player = self._download_json(request, video_id, 'Downloading player JSON')
|
player = self._download_json(request, video_id,
|
||||||
|
'Downloading player JSON')
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
video_url = player.get('urlVideo')
|
video_url = player.get('urlVideo')
|
||||||
@ -102,7 +113,9 @@ class AtresPlayerIE(InfoExtractor):
|
|||||||
video_url,
|
video_url,
|
||||||
headers={'User-Agent': self._USER_AGENT})
|
headers={'User-Agent': self._USER_AGENT})
|
||||||
try:
|
try:
|
||||||
video_data = self._download_json(request, video_id, 'Downloading video JSON', fatal=True)
|
video_data = self._download_json(request, video_id,
|
||||||
|
'Downloading video JSON',
|
||||||
|
fatal=True)
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
if len(e.exc_info) <= 1 or e.exc_info[1].code != 403:
|
if len(e.exc_info) <= 1 or e.exc_info[1].code != 403:
|
||||||
raise
|
raise
|
||||||
|
Loading…
x
Reference in New Issue
Block a user