From e71e282379751c6c340cc34f65de42cb68832b77 Mon Sep 17 00:00:00 2001 From: "guorong.zheng" <360996299@qq.com> Date: Tue, 17 Dec 2024 17:18:29 +0800 Subject: [PATCH 1/2] chore:request_timeout_entry --- tkinter_ui/default.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tkinter_ui/default.py b/tkinter_ui/default.py index 29190225f55..8462fb255a1 100644 --- a/tkinter_ui/default.py +++ b/tkinter_ui/default.py @@ -457,6 +457,7 @@ def change_entry_state(self, state): "open_request_checkbutton", "open_driver_checkbutton", "open_proxy_checkbutton", + "request_timeout_entry", "source_file_entry", "source_file_button", "final_file_entry", From 1effe286065277749204a0de8b6407121b3d53fa Mon Sep 17 00:00:00 2001 From: "guorong.zheng" <360996299@qq.com> Date: Wed, 18 Dec 2024 11:36:50 +0800 Subject: [PATCH 2/2] fix:ipv6 speed(#697) --- utils/speed.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/utils/speed.py b/utils/speed.py index 5896735eb45..56d02af786c 100644 --- a/utils/speed.py +++ b/utils/speed.py @@ -35,8 +35,8 @@ async def get_speed_with_download(url: str, timeout: int = config.sort_timeout) finally: end_time = time() total_time += end_time - start_time - info['speed'] = (total_size / total_time if total_time > 0 else 0) / 1024 / 1024 - return info + info['speed'] = (total_size / total_time if total_time > 0 else 0) / 1024 / 1024 + return info async def get_speed_m3u8(url: str, timeout: int = config.sort_timeout) -> dict[str, float | None]: @@ -45,7 +45,7 @@ async def get_speed_m3u8(url: str, timeout: int = config.sort_timeout) -> dict[s """ info = {'speed': None, 'delay': None} try: - url = quote(url, safe=':/?$&=@').partition('$')[0] + url = quote(url, safe=':/?$&=@[]').partition('$')[0] async with ClientSession(connector=TCPConnector(ssl=False), trust_env=True) as session: async with session.head(url, timeout=2) as response: if response.headers.get('Content-Length'): @@ -193,10 +193,10 @@ async def get_speed(url, ipv6_proxy=None, callback=None): if ipv6_proxy and url_is_ipv6: data['speed'] = float("inf") data['delay'] = float("-inf") - elif '.m3u8' in url: - data.update(await get_speed_m3u8(url)) - else: + elif '/rtp/' in url: data.update(await get_speed_with_download(url)) + else: + data.update(await get_speed_m3u8(url)) if cache_key and cache_key not in cache: cache[cache_key] = data return data