diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2013-12-26 21:14:43 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2013-12-26 21:14:43 +0100 |
commit | a1b92edbb36fac40babd6b593e325eb95cb85b4c (patch) | |
tree | 9a8db1e5fd1c8d07c00a8ce763e21b8b187a600d /youtube_dl/extractor/channel9.py | |
parent | 12c978739a56b1e81c72416bfab37908e0543832 (diff) |
[channel 9] Use centralized format sorting
Diffstat (limited to 'youtube_dl/extractor/channel9.py')
-rw-r--r-- | youtube_dl/extractor/channel9.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/youtube_dl/extractor/channel9.py b/youtube_dl/extractor/channel9.py index ae70ea229..574881b70 100644 --- a/youtube_dl/extractor/channel9.py +++ b/youtube_dl/extractor/channel9.py @@ -76,14 +76,18 @@ class Channel9IE(InfoExtractor): </div>)? # File size part may be missing ''' # Extract known formats - formats = [{'url': x.group('url'), - 'format_id': x.group('quality'), - 'format_note': x.group('note'), - 'format': '%s (%s)' % (x.group('quality'), x.group('note')), - 'filesize': self._restore_bytes(x.group('filesize')), # File size is approximate - } for x in list(re.finditer(FORMAT_REGEX, html)) if x.group('quality') in self._known_formats] - # Sort according to known formats list - formats.sort(key=lambda fmt: self._known_formats.index(fmt['format_id'])) + formats = [{ + 'url': x.group('url'), + 'format_id': x.group('quality'), + 'format_note': x.group('note'), + 'format': u'%s (%s)' % (x.group('quality'), x.group('note')), + 'filesize': self._restore_bytes(x.group('filesize')), # File size is approximate + 'preference': self._known_formats.index(x.group('quality')), + 'vcodec': 'none' if x.group('note') == 'Audio only' else None, + } for x in list(re.finditer(FORMAT_REGEX, html)) if x.group('quality') in self._known_formats] + + self._sort_formats(formats) + return formats def _extract_title(self, html): |