aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-01-20 04:00:37 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2016-01-20 04:00:37 +0800
commitbec30224ff86d11c3f61808dbe683f97940ba23e (patch)
treefc880d3aceb48961f58a48a75d3a5212d5cd5f29 /youtube_dl
parent0428106da33419302ac8ad31306f9357549f086e (diff)
[letv] LetvCloud: Detect ext instead of the hardcoded one
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/letv.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/youtube_dl/extractor/letv.py b/youtube_dl/extractor/letv.py
index b15ac163e..08bdae8a2 100644
--- a/youtube_dl/extractor/letv.py
+++ b/youtube_dl/extractor/letv.py
@@ -19,6 +19,7 @@ from ..utils import (
int_or_none,
str_or_none,
encode_data_uri,
+ url_basename,
)
@@ -295,12 +296,17 @@ class LetvCloudIE(InfoExtractor):
else:
raise ExtractorError('Letv cloud returned an unknwon error')
+ def b64decode(s):
+ return base64.b64decode(s.encode('utf-8')).decode('utf-8')
+
formats = []
for media in play_json['data']['video_info']['media'].values():
play_url = media['play_url']
+ url = b64decode(play_url['main_url'])
+ decoded_url = b64decode(url_basename(url))
formats.append({
- 'url': base64.b64decode(play_url['main_url'].encode('utf-8')).decode('utf-8'),
- 'ext': 'mp4',
+ 'url': url,
+ 'ext': determine_ext(decoded_url),
'format_id': int_or_none(play_url.get('vtype')),
'format_note': str_or_none(play_url.get('definition')),
'width': int_or_none(play_url.get('vwidth')),