aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Brighton <george@gebn.co.uk>2015-06-27 22:27:06 +0100
committerGeorge Brighton <george@gebn.co.uk>2015-06-27 22:28:17 +0100
commit8a1b49ff19a8a1fdc2c30cf10cc0598ac9bc8819 (patch)
treebfba687ba7876d7bfaa1dac2c1b864d8313b907a
parentb971abe897ee17fed7e36868fdc8880f6b145d7b (diff)
[moviefap] Explicitly sort formats to handle possible site changes
-rw-r--r--youtube_dl/extractor/moviefap.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/youtube_dl/extractor/moviefap.py b/youtube_dl/extractor/moviefap.py
index 20a78f3b2..295bfe3f0 100644
--- a/youtube_dl/extractor/moviefap.py
+++ b/youtube_dl/extractor/moviefap.py
@@ -111,11 +111,14 @@ class MovieFapIE(InfoExtractor):
# multiple formats available
info['formats'] = []
- # N.B. formats are already in ascending order of quality
for item in xml.find('quality').findall('item'):
+ resolution = xpath_text(item, 'res', 'resolution', True) # 480p etc.
info['formats'].append({
'url': xpath_text(item, 'videoLink', 'url', True),
- 'resolution': xpath_text(item, 'res', 'resolution', True) # 480p etc.
+ 'resolution': resolution,
+ 'height': int(re.findall(r'\d+', resolution)[0])
})
+ self._sort_formats(info['formats'])
+
return info