브라우저 헤더 설정을 개선하고 사용자 에이전트를 업데이트했습니다.

This commit is contained in:
imnyang 2025-06-07 00:05:46 +09:00
commit c0499819be

View file

@ -6,7 +6,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use rayon::prelude::*; use rayon::prelude::*;
use reqwest::blocking::Client; use reqwest::blocking::Client;
use reqwest::header::{CONTENT_TYPE, USER_AGENT}; use reqwest::header::{HeaderMap, HeaderValue, CONTENT_TYPE, USER_AGENT, ACCEPT, ACCEPT_LANGUAGE, ACCEPT_ENCODING, CONNECTION, UPGRADE_INSECURE_REQUESTS};
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
let input_file = File::open("domains.txt")?; let input_file = File::open("domains.txt")?;
@ -27,10 +27,19 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let output = Arc::new(Mutex::new(output_file)); let output = Arc::new(Mutex::new(output_file));
// 브라우저 헤더 세팅
let mut headers = HeaderMap::new();
headers.insert(USER_AGENT, HeaderValue::from_static("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0"));
headers.insert(ACCEPT, HeaderValue::from_static("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"));
headers.insert(ACCEPT_LANGUAGE, HeaderValue::from_static("ko,en-US;q=0.7,en;q=0.3"));
headers.insert(ACCEPT_ENCODING, HeaderValue::from_static("gzip, deflate, br"));
headers.insert(CONNECTION, HeaderValue::from_static("keep-alive"));
headers.insert(UPGRADE_INSECURE_REQUESTS, HeaderValue::from_static("1"));
let client = Arc::new( let client = Arc::new(
Client::builder() Client::builder()
.timeout(Duration::from_secs(5)) .timeout(Duration::from_secs(5))
.user_agent("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0") .default_headers(headers)
.build()?, .build()?,
); );