mirror of https://github.com/hepingxiaoli/tv.git
更新 cctv.py
This commit is contained in:
parent
0dd7288ce4
commit
0ddf65ad70
4
cctv.py
4
cctv.py
|
@ -33,7 +33,7 @@ def worker():
|
|||
channel_name, channel_url = task_queue.get()
|
||||
try:
|
||||
channel_url_t = channel_url.rstrip(channel_url.split('/')[-1]) # m3u8链接前缀
|
||||
lines = requests.get(channel_url).text.strip().split('\n') # 获取m3u8文件内容
|
||||
lines = requests.get(channel_url,timeout=1).text.strip().split('\n') # 获取m3u8文件内容
|
||||
ts_lists = [line.split('/')[-1] for line in lines if line.startswith('#') == False] # 获取m3u8文件下视频流后缀
|
||||
ts_lists_0 = ts_lists[0].rstrip(ts_lists[0].split('.ts')[-1]) # m3u8链接前缀
|
||||
ts_url = channel_url_t + ts_lists[0] # 拼接单个视频片段下载链接
|
||||
|
@ -41,7 +41,7 @@ def worker():
|
|||
# 多获取的视频数据进行5秒钟限制
|
||||
with eventlet.Timeout(5, False):
|
||||
start_time = time.time()
|
||||
content = requests.get(ts_url).content
|
||||
content = requests.get(ts_url,timeout=1).content
|
||||
end_time = time.time()
|
||||
response_time = (end_time - start_time) * 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue