From eec0ec4e4a33bd775ce9c1c5a5bec1b9255cdbc1 Mon Sep 17 00:00:00 2001 From: frxz751113 <156018267+frxz751113@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:47:50 +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 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/py/酒店源.py b/py/酒店源.py index ac82633..6c1f7f2 100644 --- a/py/酒店源.py +++ b/py/酒店源.py @@ -142,19 +142,20 @@ for url in valid_urls: name, channel_url = line.split(',') urls = channel_url.split('/', 3) url_data = json_url.split('/', 3) + ip_port = url_data[2] + urls[2] = urls[2].replace(urls[2].split('/')[2].split(':')[0], ip_port.split(':')[0]) + urls[2] = urls[2].replace(urls[2].split('/')[2].split(':')[1], ip_port.split(':')[1]) if len(urls) >= 4: - # 获取 json_url 中的 ip 和 port - ip_port = json_url.split('//')[1].split(':')[0] + ':' + json_url.split('//')[1].split(':')[1] - urld = (f"{urls[0]}//{ip_port}/{urls[3]}") + urld = (f"{urls[0]}//{urls[2]}/{urls[3]}") else: - # 获取 json_url 中的 ip 和 port - ip_port = json_url.split('//')[1].split(':')[0] + ':' + json_url.split('//')[1].split(':')[1] - urld = (f"{urls[0]}//{ip_port}") + urld = (f"{urls[0]}//{urls[2]}") + print(f"{name},{urld}") except: pass except: pass + # 写入到文件中 with open('iptv.txt', 'a', encoding='utf-8') as outfile: outfile.write(new_line + '\n')