aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/yahoo.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-12-25 15:18:40 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2013-12-25 15:18:40 +0100
commit7217e148fb03ea27edb12a878c959ebefec4c6c3 (patch)
tree74281d50173c15a0b88880c4ba18f7303548a58f /youtube_dl/extractor/yahoo.py
parentb874fe2da8defdd5fd945e87d746f52ef52a40f2 (diff)
downloadyoutube-dl-7217e148fb03ea27edb12a878c959ebefec4c6c3.tar.xz
[yahoo] Use centralized sorting, and add tbr field
Diffstat (limited to 'youtube_dl/extractor/yahoo.py')
-rw-r--r--youtube_dl/extractor/yahoo.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/youtube_dl/extractor/yahoo.py b/youtube_dl/extractor/yahoo.py
index 5c9c361b9..e17a39782 100644
--- a/youtube_dl/extractor/yahoo.py
+++ b/youtube_dl/extractor/yahoo.py
@@ -6,8 +6,8 @@ from .common import InfoExtractor, SearchInfoExtractor
from ..utils import (
compat_urllib_parse,
compat_urlparse,
- determine_ext,
clean_html,
+ int_or_none,
)
@@ -68,9 +68,9 @@ class YahooIE(InfoExtractor):
formats = []
for s in info['streams']:
format_info = {
- 'width': s.get('width'),
- 'height': s.get('height'),
- 'bitrate': s.get('bitrate'),
+ 'width': int_or_none(s.get('width')),
+ 'height': int_or_none(s.get('height')),
+ 'tbr': int_or_none(s.get('bitrate')),
}
host = s['host']
@@ -84,10 +84,10 @@ class YahooIE(InfoExtractor):
else:
format_url = compat_urlparse.urljoin(host, path)
format_info['url'] = format_url
- format_info['ext'] = determine_ext(format_url)
formats.append(format_info)
- formats = sorted(formats, key=lambda f:(f['height'], f['width']))
+
+ self._sort_formats(formats)
return {
'id': video_id,