Skip to content

Commit 3e42d70

Browse files
committed
iqiyi.live: update
1 parent a9ec1a0 commit 3e42d70

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Diff for: ykdl/extractors/iqiyi/live.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from ykdl.videoinfo import VideoInfo
66
from ykdl.util.html import get_content, add_header
77
from ykdl.util.match import match1
8-
from ykdl.compact import urlencode
8+
from ykdl.compact import urlencode, parse_qs
99

1010
from .util import get_random_str, get_macid, cmd5x_iqiyi3 as cmd5x
1111

@@ -72,14 +72,20 @@ def prepare(self):
7272
stream_id = self.type_2_id[stream_type]
7373

7474
if stream['formatType'] == 'HLFLV':
75+
stream_params = stream['url'].split('?')[-1]
76+
stream_params_dict = dict((k, v[0]) for k, v in parse_qs(stream_params).items())
77+
if stream_params_dict['hl_sttp'] != 'flv':
78+
continue
7579
params = {
7680
'streamName': stream['streamName'],
77-
'streamParams': stream['url'].split('?')[-1],
78-
'hl_stid': match1(stream['url'], 'hl_stid=(.+?)&')
81+
'streamParams': stream_params,
82+
'hl_stid': stream_params_dict['hl_stid'],
83+
'hl_stft': stream_params_dict['hl_stft'],
84+
'hl_stapp': stream_params_dict['hl_stapp']
7985
}
80-
url = 'https://flvlive.video.iqiyi.com/liveugc/{streamName}.flv?{streamParams}'.format(**params)
86+
url = 'https://flvlive.video.iqiyi.com/{hl_stapp}/{streamName}.{hl_stft}?{streamParams}'.format(**params)
8187
url = json.loads(get_content(url))['l']
82-
url = url.replace('{streamName}.flv?'.format(**params), '{hl_stid}.flv?'.format(**params))
88+
url = url.replace('{streamName}.'.format(**params), '{hl_stid}.'.format(**params))
8389
ext = 'flv'
8490
elif stream_id in info.streams:
8591
continue

0 commit comments

Comments
 (0)