Update 酒店源.py

This commit is contained in:
frxz751113
2024-09-04 12:55:10 +08:00
committed by GitHub
parent 91cc185568
commit 4a283cd908
+44 -42
View File
@@ -570,6 +570,49 @@ with open('iptv.txt', 'w', encoding='utf-8') as outfile:
outfile.writelines(filtered_lines)
#####################################################################
#####################################定义替换规则的字典,对整行内的多余标识内容进行替换
replacements = {
"2珠江": "TVB星河[🏠]",
"T[": "T",
"BM9家庭影院": "东森电影[🏠]",
"BM15广东影视": "广东影视[🏠]",
"BM20": "",
"3X电影": "龙祥时代[🏠]",
"4DS": "东森电影[🏠]",
"1ZX": "凤凰资讯HD[🏠]",
"2ZW": "凤凰中文HD[🏠]",
"3XG": "凤凰香港[🏠]",
"4ZW": "凤凰中文[🏠]",
"5ZX": "凤凰资讯[🏠]",
"星河台": "星河",
"dx[": "[",
"g[": "[",
"P[": "+[",
"lt[": "[",
"电信": "",
"卫视高清": "卫视",
"SCTV5": "",
"T,": ",",
"dx,": ",",
"g,": ",",
"TVBTVB星河": "TVB星河",
"5音乐台": "CCTV15",
"天映": "天映经典[🏠]",
"星河": "星河[🏠]",
"": "",
"": ""
}
# 打开原始文件读取内容,并写入新文件
with open('iptv.txt', 'r', encoding='utf-8') as file:
lines = file.readlines()
# 创建新文件并写入替换后的内容
with open('iptv.txt', 'w', encoding='utf-8') as new_file:
for line in lines:
for old, new in replacements.items():
line = line.replace(old, new)
new_file.write(line)
print("替换完成,新文件已保存。")
#####################################################################
# 定义要搜索的关键词,从文件中提取包含这个关键词的行,然后添加到另一个文件尾
keywords = ['hls', 'tsfile']
@@ -631,48 +674,7 @@ def filter_lines(input_file, output_file):
filter_lines("iptv.txt", "iptv.txt")
#####################################定义替换规则的字典,对整行内的多余标识内容进行替换
replacements = {
"2珠江": "TVB星河🏠",
"T[": "T",
"BM9家庭影院": "东森电影🏠",
"BM15广东影视": "广东影视🏠",
"BM20": "",
"3X电影": "龙祥时代🏠",
"4DS": "东森电影🏠",
"1ZX": "凤凰资讯HD🏠",
"2ZW": "凤凰中文HD🏠",
"3XG": "凤凰香港🏠",
"4ZW": "凤凰中文🏠",
"5ZX": "凤凰资讯🏠",
"星河台": "星河",
"dx[": "[",
"g[": "[",
"P[": "+[",
"lt[": "[",
"电信": "",
"卫视高清": "卫视",
"SCTV5": "",
"T,": ",",
"dx,": ",",
"g,": ",",
"TVBTVB星河": "TVB星河",
"5音乐台": "CCTV15",
"天映": "天映经典🏠",
"星河": "星河🏠",
"": "",
"": ""
}
# 打开原始文件读取内容,并写入新文件
with open('iptv.txt', 'r', encoding='utf-8') as file:
lines = file.readlines()
# 创建新文件并写入替换后的内容
with open('iptv.txt', 'w', encoding='utf-8') as new_file:
for line in lines:
for old, new in replacements.items():
line = line.replace(old, new)
new_file.write(line)
print("替换完成,新文件已保存。")
#################################################### 对整理好的频道列表测试HTTP连接
def test_connectivity(url, max_attempts=2): #定义测试HTTP连接的次数