]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[viewster] Extract height from bitrate and prefer mp4 videos
authorSergey M․ <dstftw@gmail.com>
Tue, 22 Sep 2015 15:47:56 +0000 (21:47 +0600)
committerSergey M․ <dstftw@gmail.com>
Tue, 22 Sep 2015 15:47:56 +0000 (21:47 +0600)
youtube_dl/extractor/viewster.py

index c68a38167e3a0d2c432db865b5ee84f3d83e9e86..c6aa73c0ef1cfe1e23cc5b7a55ff88f197b0240c 100644 (file)
@@ -120,11 +120,18 @@ class ViewsterIE(InfoExtractor):
                     fatal=False  # m3u8 sometimes fail
                 ))
             else:
-                formats.append({
+                format_id = media.get('Bitrate')
+                f = {
                     'url': video_url,
+                    'format_id': 'mp4-%s' % format_id,
                     'height': int_or_none(media.get('Height')),
                     'width': int_or_none(media.get('Width')),
-                })
+                    'preference': 1,
+                }
+                if format_id and not f['height']:
+                    f['height'] = int_or_none(self._search_regex(
+                        r'^(\d+)[pP]$', format_id, 'height', default=None))
+                formats.append(f)
         self._sort_formats(formats)
 
         synopsis = info.get('Synopsis', {})