mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-26 02:14:32 +01:00
[AtresPlayer] Fix issue #24026
This commit is contained in:
parent
75294a5ed0
commit
e79599c9b1
@ -13,7 +13,7 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class AtresPlayerIE(InfoExtractor):
|
class AtresPlayerIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?atresplayer\.com/[^/]+/[^/]+/[^/]+/[^/]+/(?P<display_id>.+?)_(?P<id>[0-9a-f]{24})'
|
_VALID_URL = r'https?://(?:www\.)?atresplayer\.com/[^/]+/[^/]+/[^/]+/(?P<type>.+?)/(?P<display_id>.+?)_(?P<id>[0-9a-f]{24})'
|
||||||
_NETRC_MACHINE = 'atresplayer'
|
_NETRC_MACHINE = 'atresplayer'
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
@ -61,25 +61,29 @@ class AtresPlayerIE(InfoExtractor):
|
|||||||
self._API_BASE + 'login', None, 'Downloading login page')
|
self._API_BASE + 'login', None, 'Downloading login page')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
target_url = self._download_json(
|
response = self._download_json(
|
||||||
'https://account.atresmedia.com/api/login', None,
|
'https://account.atresmedia.com/api/login', None,
|
||||||
'Logging in', headers={
|
'Logging in', headers={
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
}, data=urlencode_postdata({
|
}, data=urlencode_postdata({
|
||||||
'username': username,
|
'username': username,
|
||||||
'password': password,
|
'password': password,
|
||||||
}))['targetUrl']
|
}))
|
||||||
|
target_url = "https://account.atresmedia.com" + response['targetUrl']
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
self._handle_error(e, 400)
|
self._handle_error(e, 400)
|
||||||
|
|
||||||
self._request_webpage(target_url, None, 'Following Target URL')
|
self._request_webpage(target_url, None, 'Following Target URL')
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
display_id, video_id = re.match(self._VALID_URL, url).groups()
|
vod_type, display_id, video_id = re.match(self._VALID_URL, url).groups()
|
||||||
|
if vod_type == 'clips':
|
||||||
|
vod_url_step = 'player/v1/video/'
|
||||||
|
else:
|
||||||
|
vod_url_step = "player/v1/episode/"
|
||||||
try:
|
try:
|
||||||
episode = self._download_json(
|
episode = self._download_json(
|
||||||
self._API_BASE + 'client/v1/player/episode/' + video_id, video_id)
|
self._API_BASE + vod_url_step + video_id, video_id)
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
self._handle_error(e, 403)
|
self._handle_error(e, 403)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user