Update 测试.py
This commit is contained in:
@@ -109,11 +109,8 @@ for valid_url in valid_urls: # 确保这里是 valid_urls
|
|||||||
try:
|
try:
|
||||||
# 发送GET请求获取JSON文件,设置超时时间为3秒
|
# 发送GET请求获取JSON文件,设置超时时间为3秒
|
||||||
response = requests.get(valid_url, timeout=3)
|
response = requests.get(valid_url, timeout=3)
|
||||||
# 尝试解码响应内容为 UTF-8 格式的文本
|
json_data = response.content.decode('utf-8')
|
||||||
text_data = response.content.decode('utf-8')
|
lines = json_data.split('\n')
|
||||||
# 如果解码成功,处理 text_data
|
|
||||||
# 例如打印或进一步处理
|
|
||||||
print(text_data) # 这里只是打印,你可以根据需要进行其他处理
|
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
pass
|
pass
|
||||||
# 正则表达式匹配 #EXTINF 行
|
# 正则表达式匹配 #EXTINF 行
|
||||||
|
|||||||
Reference in New Issue
Block a user