Browse Source

Filter and sort videos before calling list_formats

totalwebcasting
rzhxeo 11 years ago
parent
commit
bfaae0a768
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      youtube_dl/YoutubeDL.py

+ 5
- 4
youtube_dl/YoutubeDL.py View File

@ -662,10 +662,6 @@ class YoutubeDL(object):
if 'ext' not in format:
format['ext'] = determine_ext(format['url'])
if self.params.get('listformats', None):
self.list_formats(info_dict)
return
format_limit = self.params.get('format_limit', None)
if format_limit:
formats = list(takewhile_inclusive(
@ -681,6 +677,11 @@ class YoutubeDL(object):
return (f.get('height'), f.get('width'), ext_ord)
formats = sorted(formats, key=_free_formats_key)
info_dict['formats'] = formats
if self.params.get('listformats', None):
self.list_formats(info_dict)
return
req_format = self.params.get('format', 'best')
if req_format is None:
req_format = 'best'


Loading…
Cancel
Save