From b879cafe1ba1e30a89c909ce1a46ae16349e9421 Mon Sep 17 00:00:00 2001 From: imnyang Date: Sat, 7 Jun 2025 00:03:15 +0900 Subject: [PATCH] =?UTF-8?q?HTML=20=EB=8F=84=EB=A9=94=EC=9D=B8=20=EC=B9=B4?= =?UTF-8?q?=EC=9A=B4=ED=84=B0=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EC=B5=9C?= =?UTF-8?q?=EC=A2=85=20=EA=B2=B0=EA=B3=BC=20=EC=B6=9C=EB=A0=A5=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- is-html-fast/src/main.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/is-html-fast/src/main.rs b/is-html-fast/src/main.rs index 10342ea..1d014d3 100644 --- a/is-html-fast/src/main.rs +++ b/is-html-fast/src/main.rs @@ -15,6 +15,9 @@ fn main() -> Result<(), Box> { let total_count = domains.len(); let counter = Arc::new(AtomicUsize::new(0)); + let html_count = Arc::new(AtomicUsize::new(0)); + let failed_count = Arc::new(AtomicUsize::new(0)); + let non_html_count = Arc::new(AtomicUsize::new(0)); let output_file = OpenOptions::new() .create(true) @@ -34,7 +37,6 @@ fn main() -> Result<(), Box> { domains.par_iter().for_each(|domain| { let current = counter.fetch_add(1, Ordering::SeqCst) + 1; let url = format!("https://{}", domain); - println!("[{}/{}] Checking {}", current, total_count, url); let response = client.get(&url).send(); @@ -46,20 +48,36 @@ fn main() -> Result<(), Box> { if let Ok(mut file) = output.lock() { writeln!(file, "{}", domain).ok(); } + html_count.fetch_add(1, Ordering::SeqCst); println!("[{}/{}] ✅ HTML: {}", current, total_count, domain); } else { + non_html_count.fetch_add(1, Ordering::SeqCst); println!("[{}/{}] ❌ Not HTML: {} ({})", current, total_count, domain, content_type_str); } } } else { + non_html_count.fetch_add(1, Ordering::SeqCst); println!("[{}/{}] ❌ No Content-Type: {}", current, total_count, domain); } } Err(_) => { + failed_count.fetch_add(1, Ordering::SeqCst); println!("[{}/{}] ⚠️ Failed to connect: {}", current, total_count, domain); } } }); + // Final results + let html_final = html_count.load(Ordering::SeqCst); + let failed_final = failed_count.load(Ordering::SeqCst); + let non_html_final = non_html_count.load(Ordering::SeqCst); + + println!("\n=== Final Results ==="); + println!("📊 Total domains: {}", total_count); + println!("✅ HTML domains: {} ({:.1}%)", html_final, (html_final as f64 / total_count as f64) * 100.0); + println!("❌ Non-HTML domains: {} ({:.1}%)", non_html_final, (non_html_final as f64 / total_count as f64) * 100.0); + println!("⚠️ Failed connections: {} ({:.1}%)", failed_final, (failed_final as f64 / total_count as f64) * 100.0); + println!("💾 HTML domains saved to: domains-filtered.txt"); + Ok(()) }