From 1ee94db2d03770c0280047c974f0e6886d2a753f Mon Sep 17 00:00:00 2001 From: kinetoskombi Date: Sat, 31 Jan 2015 20:07:43 -0200 Subject: [PATCH 1/2] [globo] Fix error on some globo videos --- youtube_dl/extractor/globo.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/globo.py b/youtube_dl/extractor/globo.py index 6949a57c7..d936be384 100644 --- a/youtube_dl/extractor/globo.py +++ b/youtube_dl/extractor/globo.py @@ -70,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(): @@ -355,7 +368,9 @@ def _real_extract(self, url): for resource in video['resources']: resource_id = resource.get('_id') - if not resource_id: + resource_height = resource.get('height') + + if not (resource_id or resource_height): continue security = self._download_json( @@ -384,7 +399,7 @@ def _real_extract(self, url): formats.append({ 'url': '%s?h=%s&k=%s' % (resource['url'], signed_hash, 'flash'), 'format_id': resource_id, - 'height': resource['height'] + 'height': resource_height }) self._sort_formats(formats) From 8c72beb25eaa1f1960a3b50295bcdcfd50c450af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Sun, 1 Feb 2015 04:36:24 +0600 Subject: [PATCH 2/2] [globo] Properly extract m3u8 formats (#4346 #4832) --- youtube_dl/extractor/globo.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/youtube_dl/extractor/globo.py b/youtube_dl/extractor/globo.py index d936be384..29638a194 100644 --- a/youtube_dl/extractor/globo.py +++ b/youtube_dl/extractor/globo.py @@ -368,9 +368,7 @@ def _real_extract(self, url): for resource in video['resources']: resource_id = resource.get('_id') - resource_height = resource.get('height') - - if not (resource_id or resource_height): + if not resource_id: continue security = self._download_json( @@ -396,11 +394,16 @@ def _real_extract(self, url): 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)