From 212c462d69f4bd79c61cf2ad22d79463918ea557 Mon Sep 17 00:00:00 2001 From: frxz751113 <156018267+frxz751113@users.noreply.github.com> Date: Sat, 31 Aug 2024 23:59:49 +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 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/py/酒店源.py b/py/酒店源.py index ea50643..300be83 100644 --- a/py/酒店源.py +++ b/py/酒店源.py @@ -280,6 +280,22 @@ with open("iptv.txt", 'w', encoding='utf-8') as file: file.write(result + "\n") print(result) #关闭频道名称和频道地址打印,缩短运行时间 print("频道列表文件iptv.txt获取完成!") + +###################################################################################################################### +###################################################去除列表中的组播地址,酒店源验证整理 +def filter_lines(input_file, output_file): + with open(input_file, 'r', encoding='utf-8') as file: + lines = file.readlines() + filtered_lines = [] + for line in lines: + if 'hls' in line: + if '东森' not in line and '龙祥' not in line: + with open(output_file, 'w', encoding='utf-8') as output_file: + output_file.writelines(filtered_lines) +filter_lines("iptv.txt", "iptv.txt") + + + for line in fileinput.input("iptv.txt", inplace=True): #打开文件,并对其进行关键词原地替换 line = line.replace("河南河南", "河南") line = line.replace("河南河南", "河南")