From 2f5bd1d5a24f46caa4065078e95b222f9a545f55 Mon Sep 17 00:00:00 2001 From: frxz751113 <156018267+frxz751113@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:35:51 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E6=B5=8B=E8=AF=95.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- py/测试.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py/测试.py b/py/测试.py index 153302d..af65847 100644 --- a/py/测试.py +++ b/py/测试.py @@ -111,12 +111,12 @@ for valid_url in valid_urls: # 确保这里是 valid_urls response = requests.get(valid_url, timeout=3) json_data = response.content.decode('utf-8') lines = json_data.split('\n') - except UnicodeDecodeError: + except requests.RequestException as e: pass + # 正则表达式匹配 #EXTINF 行 pattern = r"#EXTINF:-1 group-title=\"([^\"]+)\"," matches = re.finditer(pattern, json_data) - for match in matches: channel_name = match.group(1) # 获取下一行的 URL