X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fglobo.py;h=8a95793cae07734e67340bf49db088cdb043d1cb;hb=674fb0fcc54c72448f80a0573f7fd116f220827e;hp=77c3ad4fc8b882fe92c91574eca1b5cbabc265cd;hpb=f889cea109b4e2647e3fd6a462c9893b88b21e04;p=youtube-dl diff --git a/youtube_dl/extractor/globo.py b/youtube_dl/extractor/globo.py index 77c3ad4fc..8a95793ca 100644 --- a/youtube_dl/extractor/globo.py +++ b/youtube_dl/extractor/globo.py @@ -5,20 +5,22 @@ import random import math from .common import InfoExtractor -from ..utils import ( - ExtractorError, - float_or_none, +from ..compat import ( compat_str, compat_chr, compat_ord, ) +from ..utils import ( + ExtractorError, + float_or_none, +) class GloboIE(InfoExtractor): _VALID_URL = 'https?://.+?\.globo\.com/(?P.+)' _API_URL_TEMPLATE = 'http://api.globovideos.com/videos/%s/playlist' - _SECURITY_URL_TEMPLATE = 'http://security.video.globo.com/videos/%s/hash?player=flash&version=2.9.9.50&resource_id=%s' + _SECURITY_URL_TEMPLATE = 'http://security.video.globo.com/videos/%s/hash?player=flash&version=17.0.0.132&resource_id=%s' _VIDEOID_REGEXES = [ r'\bdata-video-id="(\d+)"', @@ -68,6 +70,19 @@ class GloboIE(InfoExtractor): 'like_count': int, } }, + { + 'url': 'http://globotv.globo.com/canal-brasil/sangue-latino/t/todos-os-videos/v/ator-e-diretor-argentino-ricado-darin-fala-sobre-utopias-e-suas-perdas/3928201/', + 'md5': 'c1defca721ce25b2354e927d3e4b3dec', + 'info_dict': { + 'id': '3928201', + 'ext': 'mp4', + 'title': 'Ator e diretor argentino, Ricado Darín fala sobre utopias e suas perdas', + 'duration': 1472.906, + 'uploader': 'Canal Brasil', + 'uploader_id': 705, + 'like_count': int, + } + }, ] class MD5(): @@ -379,11 +394,16 @@ class GloboIE(InfoExtractor): signed_md5 = self.MD5.b64_md5(received_md5 + compat_str(sign_time) + padding) signed_hash = hash_code + compat_str(received_time) + received_random + compat_str(sign_time) + padding + signed_md5 - formats.append({ - 'url': '%s?h=%s&k=%s' % (resource['url'], signed_hash, 'flash'), - 'format_id': resource_id, - 'height': resource['height'] - }) + resource_url = resource['url'] + signed_url = '%s?h=%s&k=%s' % (resource_url, signed_hash, 'flash') + if resource_id.endswith('m3u8') or resource_url.endswith('.m3u8'): + formats.extend(self._extract_m3u8_formats(signed_url, resource_id, 'mp4')) + else: + formats.append({ + 'url': signed_url, + 'format_id': resource_id, + 'height': resource.get('height'), + }) self._sort_formats(formats) @@ -395,4 +415,4 @@ class GloboIE(InfoExtractor): 'uploader_id': uploader_id, 'like_count': like_count, 'formats': formats - } \ No newline at end of file + }