mirror of
https://github.com/soimort/you-get.git
synced 2025-03-13 03:17:44 +03:00
merge zh
Merge branch 'fix-iqiyi' of https://github.com/zhangn1985/you-get into ffmpeg-live
This commit is contained in:
commit
ef0fcb0b2e
@ -11,8 +11,6 @@ import hashlib
|
||||
|
||||
import time
|
||||
|
||||
from .iqiyi_sc import gen_sc
|
||||
|
||||
'''
|
||||
Changelog:
|
||||
-> http://www.iqiyi.com/common/flashplayer/20150916/MainPlayer_5_2_28_c3_3_7_4.swf
|
||||
@ -86,26 +84,31 @@ class Iqiyi(VideoExtractor):
|
||||
name = "爱奇艺 (Iqiyi)"
|
||||
|
||||
stream_types = [
|
||||
{'id': 'high', 'container': 'mp4', 'video_profile': '高清'},
|
||||
{'id': 'standard', 'container': 'mp4', 'video_profile': '标清'},
|
||||
{'id': 'BD', 'container': 'm3u8', 'video_profile': '全高清'},
|
||||
{'id': 'FD', 'container': 'm3u8', 'video_profile': '超高清'},
|
||||
{'id': 'TD', 'container': 'm3u8', 'video_profile': '超清'},
|
||||
{'id': 'HD', 'container': 'm3u8', 'video_profile': '高清'},
|
||||
{'id': 'SD', 'container': 'm3u8', 'video_profile': '标清'},
|
||||
{'id': 'LD', 'container': 'm3u8', 'video_profile': '流畅'},
|
||||
]
|
||||
|
||||
'''
|
||||
supported_stream_types = [ 'high', 'standard']
|
||||
|
||||
|
||||
stream_to_bid = { '4k': 10, 'fullhd' : 5, 'suprt-high' : 4, 'super' : 3, 'high' : 2, 'standard' :1, 'topspeed' :96}
|
||||
'''
|
||||
ids = ['BD', 'FD', 'OD', 'TD', 'HD', 'SD', 'LD']
|
||||
vd_2_id = {21: 'TD', 2: 'HD', 4: 'FD', 17: 'BD', 96: 'LD', 1: 'SD'}
|
||||
vd_2_profile = {21: u'超清', 2: u'高清', 4: u'超高清', 17: u'全高清', 96: u'流畅', 1: u'标清'}
|
||||
|
||||
def getVMS(self,rate):
|
||||
#tm ->the flash run time for md5 usage
|
||||
#um -> vip 1 normal 0
|
||||
#authkey -> for password protected video ,replace '' with your password
|
||||
#puid user.passportid may empty?
|
||||
#TODO: support password protected video
|
||||
def getVMS(self):
|
||||
tvid, vid = self.vid
|
||||
t = int(time.time() * 1000)
|
||||
sc = gen_sc(tvid, t).decode('utf-8')
|
||||
vmsreq= 'http://cache.m.iqiyi.com/jp/tmts/{}/{}/?platForm=h5&rate={}&tvid={}&vid={}&cupid=qc_100001_100186&type=mp4&olimit=0&agenttype=13&src=d846d0c32d664d32b6b54ea48997a589&sc={}&t={}&__jsT=null'.format(tvid, vid, rate, tvid, vid, sc, t - 7)
|
||||
return json.loads(get_content(vmsreq)[13:])
|
||||
src = '76f90cbd92f94a2e925d83e8ccd22cb7'
|
||||
key = 'd5fb4bd9d50c4be6948c97edd7254b0e'
|
||||
sc = hashlib.new('md5', bytes(str(t) + key + vid, 'utf-8')).hexdigest()
|
||||
vmsreq= url = 'http://cache.m.iqiyi.com/tmts/{0}/{1}/?t={2}&sc={3}&src={4}'.format(tvid,vid,t,sc,src)
|
||||
return json.loads(get_content(vmsreq))
|
||||
|
||||
def download_playlist_by_url(self, url, **kwargs):
|
||||
self.url = url
|
||||
@ -128,12 +131,16 @@ class Iqiyi(VideoExtractor):
|
||||
r1(r'vid=([^&]+)', self.url) or \
|
||||
r1(r'data-player-videoid="([^"]+)"', html)
|
||||
self.vid = (tvid, videoid)
|
||||
self.title = match1(html, '<title>([^<]+)').split('-')[0]
|
||||
|
||||
info = self.getVMS()
|
||||
assert info['code'] == 'A00000', 'can\'t play this video'
|
||||
|
||||
for stream in info['data']['vidl']:
|
||||
stream_id = self.vd_2_id[stream['vd']]
|
||||
stream_profile = self.vd_2_profile[stream['vd']]
|
||||
self.streams[stream_id] = {'video_profile': stream_profile, 'container': 'm3u8', 'src': [stream['m3u']], 'size' : 0}
|
||||
|
||||
for stream in self.supported_stream_types:
|
||||
info = self.getVMS(self.stream_to_bid[stream])
|
||||
if info["code"] == "A00000":
|
||||
self.title = info['data']['playInfo']['vn']
|
||||
self.streams[stream] = {'container': 'mp4', 'video_profile': stream, 'src' : [info['data']['m3u']], 'size' : url_size(info['data']['m3u'])}
|
||||
'''
|
||||
if info["code"] != "A000000":
|
||||
log.e("[error] outdated iQIYI key")
|
||||
|
Loading…
x
Reference in New Issue
Block a user