From 2a9a77cb25abffbb18041733605813c98b55e312 Mon Sep 17 00:00:00 2001 From: frxz751113 <156018267+frxz751113@users.noreply.github.com> Date: Tue, 27 Aug 2024 19:23:42 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E7=BD=91=E7=BB=9C=E6=94=B6=E9=9B=86.p?= =?UTF-8?q?y?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- py/网络收集.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/py/网络收集.py b/py/网络收集.py index 95ae4a5..82b5108 100644 --- a/py/网络收集.py +++ b/py/网络收集.py @@ -347,7 +347,7 @@ def parse_file(input_file_path, output_file_name): ip_or_domain_to_lines[ip_or_domain].append(line) ############################################################################### 过滤掉小于1500字节的IP或域名段 filtered_ip_or_domain_to_lines = {ip_or_domain: lines for ip_or_domain, lines in ip_or_domain_to_lines.items() - if sum(len(line) for line in lines) >= 200} + if sum(len(line) for line in lines) >= 1000} # 如果没有满足条件的IP或域名段,则不生成文件 if not filtered_ip_or_domain_to_lines: print("没有满足条件的IP或域名段,不生成文件。") @@ -411,7 +411,7 @@ with open(output_file_path, 'w', encoding='utf-8') as output_file: start_time = time.time() frame_count = 0 # 尝试捕获10秒内的帧 - while frame_count < 10 and (time.time() - start_time) < 5: + while frame_count < 10 and (time.time() - start_time) < 3: ret, frame = cap.read() if not ret: break @@ -439,7 +439,7 @@ from urllib.parse import urlparse from tqdm import tqdm # 测试HTTP连接并尝试下载数据 -def test_connectivity_and_download(url, initial_timeout=3, retry_timeout=5): +def test_connectivity_and_download(url, initial_timeout=2, retry_timeout=3): parsed_url = urlparse(url) if parsed_url.scheme not in ['http', 'https']: # 非HTTP(s)协议,尝试RTSP检测 @@ -555,7 +555,7 @@ def parse_file(input_file_path, output_file_name): ip_or_domain_to_lines[ip_or_domain].append(line) # 过滤掉小于1000字节的IP或域名段 filtered_ip_or_domain_to_lines = {ip_or_domain: lines for ip_or_domain, lines in ip_or_domain_to_lines.items() - if sum(len(line) for line in lines) >= 200} # 过滤掉小于1000字节的IP或域名段 + if sum(len(line) for line in lines) >= 800} # 过滤掉小于1000字节的IP或域名段 # 如果没有满足条件的IP或域名段,则不生成文件 if not filtered_ip_or_domain_to_lines: print("没有满足条件的IP或域名段,不生成文件。")