diff options
author | Yen Chi Hsuan <yan12125@gmail.com> | 2016-01-20 03:17:35 +0800 |
---|---|---|
committer | Yen Chi Hsuan <yan12125@gmail.com> | 2016-01-20 03:17:35 +0800 |
commit | 10defdd06a1ea878087f5bad6ee99da3b2f9d3f6 (patch) | |
tree | bc0fca199b1175b9524c5487bcb76a531afedee8 /youtube_dl | |
parent | 78be2eca7cb2806c3a51547da14968336febb57c (diff) |
[letv] Reduce duplicated codes
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/letv.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/youtube_dl/extractor/letv.py b/youtube_dl/extractor/letv.py index c096cb1ab..d43b4e808 100644 --- a/youtube_dl/extractor/letv.py +++ b/youtube_dl/extractor/letv.py @@ -281,14 +281,17 @@ class LetvCloudIE(InfoExtractor): "uu=" + uu + "&vu=" + vu) play_json = self._download_json(play_json_req, media_id, 'Downloading playJson data') - formats = [{ - 'url': base64.b64decode(media['play_url']['main_url'].encode('utf-8')).decode("utf-8"), - 'ext': 'mp4', - 'format_id': int_or_none(media.get('play_url', {}).get('vtype')), - 'format_note': str_or_none(media.get('play_url', {}).get('definition')), - 'width': int_or_none(media.get('play_url', {}).get('vwidth')), - 'height': int_or_none(media.get('play_url', {}).get('vheight')), - } for media in play_json['data']['video_info']['media'].values()] + formats = [] + for media in play_json['data']['video_info']['media'].values(): + play_url = media['play_url'] + formats.append({ + 'url': base64.b64decode(play_url['main_url'].encode('utf-8')).decode("utf-8"), + 'ext': 'mp4', + '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')), + 'height': int_or_none(play_url.get('vheight')), + }) self._sort_formats(formats) return { |