]> git.bitcoin.ninja Git - youtube-dl/commitdiff
youku default to download hd2 video
authordongmao zhang <deanraccoon@gmail.com>
Wed, 8 Aug 2012 18:53:21 +0000 (02:53 +0800)
committerdongmao zhang <deanraccoon@gmail.com>
Wed, 8 Aug 2012 18:53:21 +0000 (02:53 +0800)
youtube-dl
youtube_dl/InfoExtractors.py

index f2268af227b0eee8548aa6d106861cc508879931..09e205cc1f9333412cfafad15804b7d9c864abea 100755 (executable)
Binary files a/youtube-dl and b/youtube-dl differ
index e1fc93b6b01ae86c105a1430d391e7bbbfbaab2d..00953a2546c57222c8cbadafcae06d8fc17d7df5 100644 (file)
@@ -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)