From d2b2d7f9b97d3c19a3005b54c6ace31db01f2a80 Mon Sep 17 00:00:00 2001 From: frxz751113 <156018267+frxz751113@users.noreply.github.com> Date: Sun, 1 Sep 2024 00:25:32 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E9=85=92=E5=BA=97=E6=BA=90.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- py/酒店源.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/py/酒店源.py b/py/酒店源.py index 5d67362..faf1208 100644 --- a/py/酒店源.py +++ b/py/酒店源.py @@ -146,8 +146,9 @@ for url in urls: try: # 按行分割数据 lines = json_data.split('\n') + excluded_keywords = ['udp', 'rtp', '东森', '龙祥'] for line in lines: - if 'hls' in line and ('udp' not in line and 'rtp' not in line and '东森' not in line and '龙祥' not in line): #行中需包含m3u,但排除udp和trp + if 'hls' in line and all(keyword not in line for keyword in excluded_keywords): line = line.strip() if line: name, channel_url = line.split(',') @@ -157,7 +158,7 @@ for url in urls: urld = (f"{urls[0]}//{url_data[2]}/{urls[3]}") else: urld = (f"{urls}") - print(f"{name},{urld}") #关闭频道名称和频道地址打印,缩短运行时间 + #print(f"{name},{urld}") #关闭频道名称和频道地址打印,缩短运行时间 if name and urld: name = name.replace("高清电影", "影迷电影") name = name.replace("中央", "CCTV") @@ -419,7 +420,7 @@ for url in urls: # 如果urlx不以'http'开头,则在前面添加一个前缀(注意:这里的url_x变量未在代码中定义) else: urld = f"{url_x}{urlx}" - print(f"{name},{urld}") #关闭频道名称和频道地址打印,缩短运行时间 + #print(f"{name},{urld}") #关闭频道名称和频道地址打印,缩短运行时间 if name and urld: name = name.replace("高清电影", "影迷电影") name = name.replace("中央", "CCTV") @@ -554,6 +555,7 @@ for result in results: with open("iptv.txt", 'a', encoding='utf-8') as file: for channel_name, channel_url in channels: file.write(f"{channel_name},{channel_url}\n") + print(result) #关闭频道名称和频道地址打印,缩短运行时间 print("频道列表文件iptv.txt追加写入成功!") def remove_duplicates(input_file, output_file):