aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/youku.py
diff options
context:
space:
mode:
authorPeterDing <dfhayst@gmail.com>2015-05-30 10:03:32 +0800
committerPeterDing <dfhayst@gmail.com>2015-05-30 10:03:32 +0800
commit08f7db20c16743a2bd3040eb7dac11d675011eef (patch)
tree41ccbf337220e8303dc5dce3c50ccb45458899fd /youtube_dl/extractor/youku.py
parent1498940b10a3f43490c05045ebe7a517267a2bff (diff)
[youku] change format_id
Diffstat (limited to 'youtube_dl/extractor/youku.py')
-rw-r--r--youtube_dl/extractor/youku.py37
1 files changed, 24 insertions, 13 deletions
diff --git a/youtube_dl/extractor/youku.py b/youtube_dl/extractor/youku.py
index 063f2e10e..aed6b960a 100644
--- a/youtube_dl/extractor/youku.py
+++ b/youtube_dl/extractor/youku.py
@@ -132,26 +132,37 @@ class YoukuIE(InfoExtractor):
def get_hd(self, fm):
hd_id_dict = {
- 'flv': '0',
- 'mp4': '1',
- 'hd2': '2',
- 'hd3': '3',
- '3gp': '0',
- '3gphd': '1'
+ 'flv' : '0',
+ 'mp4' : '1',
+ 'hd2' : '2',
+ 'hd3' : '3',
+ '3gp' : '0',
+ '3gphd' : '1'
}
return hd_id_dict[fm]
def parse_ext_l(self, fm):
ext_dict = {
- 'flv': 'flv',
- 'mp4': 'mp4',
- 'hd2': 'flv',
- 'hd3': 'flv',
- '3gp': 'flv',
- '3gphd': 'mp4',
+ 'flv' : 'flv',
+ 'mp4' : 'mp4',
+ 'hd2' : 'flv',
+ 'hd3' : 'flv',
+ '3gp' : 'flv',
+ '3gphd' : 'mp4'
}
return ext_dict[fm]
+ def get_format_name(self, fm):
+ _dict = {
+ '3gp' : 'h6',
+ '3gphd' : 'h5',
+ 'flv' : 'h4',
+ 'mp4' : 'h3',
+ 'hd2' : 'h2',
+ 'hd3' : 'h1'
+ }
+ return _dict[fm]
+
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id')
@@ -191,7 +202,7 @@ class YoukuIE(InfoExtractor):
entries[i]['formats'].append(
{
'url': video_urls[i],
- 'format_id': fm,
+ 'format_id': self.get_format_name(fm),
'ext': self.parse_ext_l(fm),
'filesize': int(data1['segs'][fm][i]['size'])
}