diff --git a/config/config.ini b/config/config.ini index 19b805a01e..3b30f38707 100644 --- a/config/config.ini +++ b/config/config.ini @@ -9,6 +9,8 @@ urls_limit = 30 open_keep_all = False open_sort = True open_ffmpeg = True +open_filter_resolution = True +min_resolution = 1920x1080 response_time_weight = 0.5 resolution_weight = 0.5 recent_days = 30 @@ -17,7 +19,7 @@ domain_blacklist = epg.pw,skype.serv00.net open_m3u_result = True url_keywords_blacklist = open_subscribe = True -subscribe_urls = https://ghproxy.net/https://raw.githubusercontent.com/kimwang1978/collect-tv-txt/main/merged_output.txt,https://m3u.ibert.me/txt/fmml_dv6.txt,https://m3u.ibert.me/txt/o_cn.txt,https://m3u.ibert.me/txt/j_iptv.txt,https://github.moeyy.xyz/https://raw.githubusercontent.com/PizazzGY/TVBox/main/live.txt +subscribe_urls = http://102.134.54.106:3099/live/全国酒店源mini.txt,https://ghproxy.net/https://raw.githubusercontent.com/kimwang1978/collect-tv-txt/main/merged_output.txt,https://m3u.ibert.me/txt/fmml_dv6.txt,https://m3u.ibert.me/txt/o_cn.txt,https://m3u.ibert.me/txt/j_iptv.txt,https://github.moeyy.xyz/https://raw.githubusercontent.com/PizazzGY/TVBox/main/live.txt open_multicast = True open_multicast_tonkiang = True open_multicast_fofa = True diff --git a/main.py b/main.py index 9e2fce5725..fd030d95af 100644 --- a/main.py +++ b/main.py @@ -207,9 +207,9 @@ async def main(self): print(f"Update completed! Please check the {user_final_file} file!") if self.run_ui: tip = ( - "服务启动成功, 可访问以下链接:" + "服务启动成功, 可使用以下链接观看直播:" if config.getboolean("Settings", "open_update") == False - else f"更新完成, 请检查{user_final_file}文件, 可访问以下链接:" + else f"更新完成, 请检查{user_final_file}文件, 可使用以下链接观看直播:" ) self.update_progress( tip, @@ -251,7 +251,10 @@ def scheduled_task(): def run_app(): if not os.environ.get("GITHUB_ACTIONS"): - print(f"You can access the result at {get_ip_address()}") + ip_address = get_ip_address() + print(f"You can use this url to watch the live stream: {ip_address}") + print(f"Result detail: {ip_address}/result") + print(f"Log detail: {ip_address}/log") app.run(host="0.0.0.0", port=8000) diff --git a/updates/fofa/fofa_hotel_region_result.pkl b/updates/fofa/fofa_hotel_region_result.pkl index 96fa415600..e52a13ef16 100644 Binary files a/updates/fofa/fofa_hotel_region_result.pkl and b/updates/fofa/fofa_hotel_region_result.pkl differ diff --git a/updates/fofa/fofa_multicast_region_result.pkl b/updates/fofa/fofa_multicast_region_result.pkl index 5f37c6200f..42b42ec1c3 100644 Binary files a/updates/fofa/fofa_multicast_region_result.pkl and b/updates/fofa/fofa_multicast_region_result.pkl differ diff --git a/utils/channel.py b/utils/channel.py index bbe39a7844..ba0fbc40f7 100644 --- a/utils/channel.py +++ b/utils/channel.py @@ -772,15 +772,18 @@ def get_channel_data_cache_with_compare(data, new_data): """ Get channel data with cache compare new data """ - - def match_url(url, sort_urls): - url = url.split("$", 1)[0] - return url in sort_urls - for cate, obj in new_data.items(): for name, url_info in obj.items(): if url_info and cate in data and name in data[cate]: - new_urls = {new_url for new_url, _, _ in url_info} - data[cate][name] = [ - info for info in data[cate][name] if match_url(info[0], new_urls) - ] + new_urls = { + new_url.split("$", 1)[0]: new_resolution + for new_url, _, new_resolution in url_info + } + updated_data = [] + for info in data[cate][name]: + url, date, resolution = info + base_url = url.split("$", 1)[0] + if base_url in new_urls: + resolution = new_urls[base_url] + updated_data.append((url, date, resolution)) + data[cate][name] = updated_data diff --git a/utils/speed.py b/utils/speed.py index 84770d57b2..20f2076699 100644 --- a/utils/speed.py +++ b/utils/speed.py @@ -3,7 +3,7 @@ import asyncio import re from utils.config import config -from utils.tools import is_ipv6 +from utils.tools import is_ipv6, get_resolution_value import subprocess timeout = 15 @@ -188,15 +188,6 @@ async def sort_urls_by_speed_and_resolution( ) ) valid_response = [res for res in response if res != float("inf")] - - def extract_resolution(resolution_str): - numbers = re.findall(r"\d+x\d+", resolution_str) - if numbers: - width, height = map(int, numbers[0].split("x")) - return width * height - else: - return 0 - default_response_time_weight = 0.5 default_resolution_weight = 0.5 response_time_weight = ( @@ -217,7 +208,7 @@ def extract_resolution(resolution_str): def combined_key(item): (_, _, resolution), response_time = item - resolution_value = extract_resolution(resolution) if resolution else 0 + resolution_value = get_resolution_value(resolution) if resolution else 0 return ( -(response_time_weight * response_time) + resolution_weight * resolution_value diff --git a/utils/tools.py b/utils/tools.py index 78595d0570..96b2171248 100644 --- a/utils/tools.py +++ b/utils/tools.py @@ -110,11 +110,31 @@ def get_soup(source): return soup +def get_resolution_value(resolution_str): + """ + Get resolution value from string + """ + numbers = re.findall(r"\d+x\d+", resolution_str) + if numbers: + width, height = map(int, numbers[0].split("x")) + return width * height + else: + return 0 + + def get_total_urls_from_info_list(infoList): """ Get the total urls from info list """ - total_urls = [url for url, _, _ in infoList] + open_filter_resolution = config.getboolean("Settings", "open_filter_resolution") + min_resolution = get_resolution_value(config.get("Settings", "min_resolution")) + total_urls = [] + for url, _, resolution in infoList: + if open_filter_resolution and resolution: + resolution_value = get_resolution_value(resolution) + if resolution_value < min_resolution: + continue + total_urls.append(url) return list(dict.fromkeys(total_urls))[: config.getint("Settings", "urls_limit")]