projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
55e663a
)
[mit] Add support for multiple formats
author
Philipp Hagemeister
<phihag@phihag.de>
Tue, 24 Dec 2013 11:38:08 +0000
(12:38 +0100)
committer
Philipp Hagemeister
<phihag@phihag.de>
Tue, 24 Dec 2013 11:38:08 +0000
(12:38 +0100)
youtube_dl/extractor/mit.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/mit.py
b/youtube_dl/extractor/mit.py
index 52be9232fe12d394ed600c349721339c5891a78a..ab8b7ec3ea06624901b9ca97e0f37f7417b095f8 100644
(file)
--- a/
youtube_dl/extractor/mit.py
+++ b/
youtube_dl/extractor/mit.py
@@
-3,6
+3,7
@@
import json
from .common import InfoExtractor
from ..utils import (
from .common import InfoExtractor
from ..utils import (
+ compat_str,
clean_html,
get_element_by_id,
)
clean_html,
get_element_by_id,
)
@@
-33,8
+34,18
@@
class TechTVMITIE(InfoExtractor):
raw_page, u'base url')
formats_json = self._search_regex(r'bitrates: (\[.+?\])', raw_page,
u'video formats')
raw_page, u'base url')
formats_json = self._search_regex(r'bitrates: (\[.+?\])', raw_page,
u'video formats')
- formats = json.loads(formats_json)
- formats = sorted(formats, key=lambda f: f['bitrate'])
+ formats_mit = json.loads(formats_json)
+ formats = [
+ {
+ 'format_id': f['label'],
+ 'url': base_url + f['url'].partition(':')[2],
+ 'ext': f['url'].partition(':')[0],
+ 'format': f['label'],
+ 'width': f['width'],
+ 'vbr': f['bitrate'],
+ }
+ for f in formats_mit
+ ]
title = get_element_by_id('edit-title', clean_page)
description = clean_html(get_element_by_id('edit-description', clean_page))
title = get_element_by_id('edit-title', clean_page)
description = clean_html(get_element_by_id('edit-description', clean_page))
@@
-43,8
+54,7
@@
class TechTVMITIE(InfoExtractor):
return {'id': video_id,
'title': title,
return {'id': video_id,
'title': title,
- 'url': base_url + formats[-1]['url'].replace('mp4:', ''),
- 'ext': 'mp4',
+ 'formats': formats,
'description': description,
'thumbnail': thumbnail,
}
'description': description,
'thumbnail': thumbnail,
}