aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordongmao zhang <deanraccoon@gmail.com>2012-08-09 02:53:21 +0800
committerdongmao zhang <deanraccoon@gmail.com>2012-08-09 02:53:21 +0800
commit0a98b09bc2d0553f0f5bd44c26b468e55a163d07 (patch)
tree2ef41b26ba452aeed3adbb10428f43a27a93e329
parent302efc19ea970c3737f088d21b69f440d7f440e3 (diff)
youku default to download hd2 video
-rwxr-xr-xyoutube-dlbin40663 -> 42046 bytes
-rw-r--r--youtube_dl/InfoExtractors.py24
2 files changed, 20 insertions, 4 deletions
diff --git a/youtube-dl b/youtube-dl
index f2268af22..09e205cc1 100755
--- a/youtube-dl
+++ b/youtube-dl
Binary files differ
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index e1fc93b6b..00953a254 100644
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -3035,11 +3035,27 @@ class YoukuIE(InfoExtractor):
video_title = config['data'][0]['title']
seed = config['data'][0]['seed']
- #choose format flv first
- format = 'flv'
+
+ format = self._downloader.params.get('format', None)
+ supported_format = config['data'][0]['streamfileids'].keys()
+
+ if format is None or format == 'best':
+ if 'hd2' in supported_format:
+ format = 'hd2'
+ else:
+ format = 'flv'
+ ext = u'flv'
+ elif format == 'worst':
+ format = 'mp4'
+ ext = u'mp4'
+ else:
+ format = 'flv'
+ ext = u'flv'
+
fileid = config['data'][0]['streamfileids'][format]
seg_number = len(config['data'][0]['segs'][format])
+
keys=[]
for i in xrange(seg_number):
keys.append(config['data'][0]['segs'][format][i]['k'])
@@ -3065,8 +3081,8 @@ class YoukuIE(InfoExtractor):
'id': '%s_part%02x' % (video_id, index),
'url': download_url,
'uploader': None,
- 'title': '%s_part%02x' % (video_title, index),
- 'ext': u'flv',
+ 'title': video_title
+ 'ext': ext,
'format': u'NA'
}
files_info.append(info)