aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-02-01 04:36:24 +0600
committerSergey M․ <dstftw@gmail.com>2015-02-01 04:36:24 +0600
commit8c72beb25eaa1f1960a3b50295bcdcfd50c450af (patch)
tree04f3e579b88bd5203b4a0acb1abb15dea357a934
parent1ee94db2d03770c0280047c974f0e6886d2a753f (diff)
[globo] Properly extract m3u8 formats (#4346 #4832)
-rw-r--r--youtube_dl/extractor/globo.py19
1 files 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 @@ class GloboIE(InfoExtractor):
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 @@ 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)