Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def getvps(tvid, vid):
tm = int(time.time() * 1000)
host = 'http://cache.video.qiyi.com'
params = {
'tvid': tvid,
'vid': vid,
'v': 0,
'qypid': '{}_12'.format(tvid),
'src': '01012001010000000000',
't': tm,
'k_tag': 1,
'k_uid': get_macid(),
'rs': 1,
}
src = '/vps?{}'.format(urlencode(params))
vf = md5x(src)
req_url = '{}{}&vf={}'.format(host, src, vf)
html = get_content(req_url)
return json.loads(html)
def getdash(tvid, vid, bid=500):
tm = int(time.time() * 1000)
host = 'https://cache.video.iqiyi.com'
params = {
#'uid': '',
'k_uid': get_macid(), # necessary
#'dfp': dfp,
#'pck': '',
#'bop': '{{"version":"10.0","dfp":"{dfp}"}}'.format(dfp=dfp),
# keys above are relative to cookies
'tvid': tvid,
'bid': bid,
'vid': vid,
'src': '01010031010000000000',
'vt': 0,
'rs': 1,
'ori': 'pcw',
'ps': 1,
'pt': 0,
'd': 0,
's': '',
'lid': '',
def getlive(vid):
tm = time.time()
host = 'https://live.video.iqiyi.com'
params = {
'lp': vid,
'src': '01010031010000000000',
'uid': '',
'rateVers': 'PC_QIYI_3',
'k_uid': get_macid(24),
'qdx': 'n',
'qdv': 3,
'qd_v': 1,
'dfp': get_random_str(66),
'v': 1,
'k_err_retries': 0,
'tm': int(tm + 1),
}
src = '/live?{}'.format(urlencode(params))
vf = cmd5x(src)
req_url = '{}{}&vf={}'.format(host, src, vf)
st = int(tm * 1000)
et = int((tm + 1296000) * 1000)
c_dfp = '__dfp={}@{}@{}'.format(params['dfp'], et, st)
add_header('Cookie', c_dfp)
html = get_content(req_url)