更新 cctv.py

This commit is contained in:
ssili126 2024-02-28 17:00:02 +08:00 committed by GitHub
parent 0dd7288ce4
commit 0ddf65ad70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -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