diff --git a/youtube_dl/extractor/atresplayer.py b/youtube_dl/extractor/atresplayer.py index fc8b212cf..bfdbf34a0 100644 --- a/youtube_dl/extractor/atresplayer.py +++ b/youtube_dl/extractor/atresplayer.py @@ -21,31 +21,19 @@ class AtresPlayerIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?atresplayer\.com/[^/]+/[^/]+/[^/]+/[^/]+/[^/_]+_(?P[A-z0-9]+)/?' _NETRC_MACHINE = 'atresplayer' _TESTS = [ - # { - # # TODO: - # 'url': 'http://www.atresplayer.com/television/programas/el-club-de-la-comedia/temporada-4/capitulo-10-especial-solidario-nochebuena_2014122100174.html', - # 'md5': 'efd56753cda1bb64df52a3074f62e38a', - # 'info_dict': { - # 'id': 'capitulo-10-especial-solidario-nochebuena', - # 'ext': 'mp4', - # 'title': 'Especial Solidario de Nochebuena', - # 'description': 'md5:e2d52ff12214fa937107d21064075bf1', - # 'duration': 5527.6, - # 'thumbnail': r're:^https?://.*\.jpg$', - # }, - # 'skip': 'This video is only available for registered users' - # }, { - # TODO: 'url': 'https://www.atresplayer.com/lasexta/series/navy-investigacion-criminal/temporada-12/capitulo-10-captulo_5ad6869b986b2866f89ebca0/', 'md5': '3afa3d3cc155264374916f2a23d1d00c', 'info_dict': { 'id': '5ad6869b986b2866f89ebca0', - 'ext': 'mp4', - # 'title': 'David Bustamante', - # 'description': 'md5:f33f1c0a05be57f6708d4dd83a3b81c6', - # 'duration': 1439.0, - # 'thumbnail': r're:^https?://.*\.jpg$', + 'ext': 'm3u8', + 'title': u'CapĂ­tulo 10: Reglas de casa', + 'description': 'md5:3ec43e9b7da2cd1280fa80adccdd09b0', + 'duration': 2500.0, + 'thumbnail': r're:^https://imagenes.atresplayer.com/.+$' + }, + 'params': { + 'skip_download': True, }, }, { @@ -96,17 +84,10 @@ class AtresPlayerIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - webpage = self._download_webpage(url, video_id) - - # episode_id = self._search_regex( - # r'episode="([^"]+)"', webpage, 'episode id') - - episode_id = video_id - request = sanitized_Request( - self._PLAYER_URL_TEMPLATE % episode_id, + self._PLAYER_URL_TEMPLATE % video_id, headers={'User-Agent': self._USER_AGENT}) - player = self._download_json(request, episode_id, 'Downloading player JSON') + player = self._download_json(request, video_id, 'Downloading player JSON') episode_type = player.get('typeOfEpisode') error_message = self._ERRORS.get(episode_type) @@ -120,7 +101,7 @@ class AtresPlayerIE(InfoExtractor): request = sanitized_Request( video_url, headers={'User-Agent': self._USER_AGENT}) - video_data = self._download_json(request, episode_id, 'Downloading video JSON') + video_data = self._download_json(request, video_id, 'Downloading video JSON') for source in video_data['sources']: if source['type'] == "application/dash+xml": @@ -132,74 +113,11 @@ class AtresPlayerIE(InfoExtractor): source['src'], video_id, fatal=False)) - # if video_url: - # format_info = { - # 'url': video_url, - # 'format_id': 'http', - # } - # mobj = re.search(r'(?P\d+)K_(?P\d+)x(?P\d+)', video_url) - # if mobj: - # format_info.update({ - # 'width': int_or_none(mobj.group('width')), - # 'height': int_or_none(mobj.group('height')), - # 'tbr': int_or_none(mobj.group('bitrate')), - # }) - # formats.append(format_info) - - # timestamp = int_or_none(self._download_webpage( - # self._TIME_API_URL, - # video_id, 'Downloading timestamp', fatal=False), 1000, time.time()) - # timestamp_shifted = compat_str(timestamp + self._TIMESTAMP_SHIFT) - # token = hmac.new( - # self._MAGIC.encode('ascii'), - # (episode_id + timestamp_shifted).encode('utf-8'), hashlib.md5 - # ).hexdigest() - # - # request = sanitized_Request( - # self._URL_VIDEO_TEMPLATE.format('windows', episode_id, timestamp_shifted, token), - # headers={'User-Agent': self._USER_AGENT}) - # - # try: - # fmt_json = self._download_json( - # request, video_id, 'Downloading windows video JSON') - # except ExtractorError as e: - # fmt_json = {'resultObject': {}} - # else: - # result = fmt_json.get('resultDes') - # if result.lower() != 'ok': - # raise ExtractorError( - # '%s returned error: %s' % (self.IE_NAME, result), expected=True) - - # for format_id, video_url in fmt_json['resultObject'].items(): - # if format_id == 'token' or not video_url.startswith('http'): - # continue - # if 'geodeswowsmpra3player' in video_url: - # # f4m_path = video_url.split('smil:', 1)[-1].split('free_', 1)[0] - # # f4m_url = 'http://drg.antena3.com/{0}hds/es/sd.f4m'.format(f4m_path) - # # this videos are protected by DRM, the f4m downloader doesn't support them - # continue - # video_url_hd = video_url.replace('free_es', 'es') - # formats.extend(self._extract_f4m_formats( - # video_url_hd[:-9] + '/manifest.f4m', video_id, f4m_id='hds', - # fatal=False)) - # formats.extend(self._extract_mpd_formats( - # video_url_hd[:-9] + '/manifest.mpd', video_id, mpd_id='dash', - # fatal=False)) self._sort_formats(formats) - # - # subtitles = {} - # subtitle_url = xpath_text(episode, './media/asset/files/subtitle', 'subtitle') - # if subtitle_url: - # subtitles['es'] = [{ - # 'ext': 'srt', - # 'url': subtitle_url, - # }] - return { 'id': video_id, 'title': video_data['titulo'], - # 'title': title, 'description': video_data['descripcion'], 'thumbnail': video_data['imgPoster'], 'duration': video_data['duration'],