strip garbage

This commit is contained in:
Milim 2024-08-14 21:34:18 +02:00
parent d5524d7eae
commit 6567af268e
No known key found for this signature in database
36 changed files with 496 additions and 2434 deletions

View file

@ -43,16 +43,9 @@ impl SearchEngine for Brave {
page: u32,
user_agent: &str,
client: &Client,
safe_search: u8,
) -> Result<Vec<(String, SearchResult)>, EngineError> {
let url = format!("https://search.brave.com/search?q={query}&offset={page}");
let safe_search_level = match safe_search {
0 => "off",
1 => "moderate",
_ => "strict",
};
let header_map = HeaderMap::try_from(&HashMap::from([
("User-Agent".to_string(), user_agent.to_string()),
(
@ -60,10 +53,7 @@ impl SearchEngine for Brave {
"application/x-www-form-urlencoded".to_string(),
),
("Referer".to_string(), "https://google.com/".to_string()),
(
"Cookie".to_string(),
format!("safe_search={safe_search_level}"),
),
("Cookie".to_string(), "safe_search=off".into()),
]))
.change_context(EngineError::UnexpectedError)?;