feat: 请求中header的User-Agent使用随机值 (#447)

This commit is contained in:
Thomas Yang
2025-08-27 11:27:23 +09:00
committed by GitHub
parent fd90bc8b73
commit 8ed2fbae24
4 changed files with 40 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ use anyhow::Result;
use leaky_bucket::RateLimiter;
use reqwest::{Method, header};
use sea_orm::DatabaseConnection;
use ua_generator::ua;
use crate::bilibili::Credential;
use crate::bilibili::credential::WbiImg;
@@ -19,9 +20,7 @@ impl Client {
let mut headers = header::HeaderMap::new();
headers.insert(
header::USER_AGENT,
header::HeaderValue::from_static(
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
),
header::HeaderValue::from_static(ua::spoof_chrome_mac_ua()),
);
headers.insert(
header::REFERER,