[youku] change format_id

This commit is contained in:
PeterDing 2015-05-30 10:03:32 +08:00
parent 1498940b10
commit 08f7db20c1

View file

@ -132,26 +132,37 @@ def generate_ep(format, n):
def get_hd(self, fm): def get_hd(self, fm):
hd_id_dict = { hd_id_dict = {
'flv': '0', 'flv' : '0',
'mp4': '1', 'mp4' : '1',
'hd2': '2', 'hd2' : '2',
'hd3': '3', 'hd3' : '3',
'3gp': '0', '3gp' : '0',
'3gphd': '1' '3gphd' : '1'
} }
return hd_id_dict[fm] return hd_id_dict[fm]
def parse_ext_l(self, fm): def parse_ext_l(self, fm):
ext_dict = { ext_dict = {
'flv': 'flv', 'flv' : 'flv',
'mp4': 'mp4', 'mp4' : 'mp4',
'hd2': 'flv', 'hd2' : 'flv',
'hd3': 'flv', 'hd3' : 'flv',
'3gp': 'flv', '3gp' : 'flv',
'3gphd': 'mp4', '3gphd' : 'mp4'
} }
return ext_dict[fm] 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): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id') video_id = mobj.group('id')
@ -191,7 +202,7 @@ def _real_extract(self, url):
entries[i]['formats'].append( entries[i]['formats'].append(
{ {
'url': video_urls[i], 'url': video_urls[i],
'format_id': fm, 'format_id': self.get_format_name(fm),
'ext': self.parse_ext_l(fm), 'ext': self.parse_ext_l(fm),
'filesize': int(data1['segs'][fm][i]['size']) 'filesize': int(data1['segs'][fm][i]['size'])
} }