| Crates.io | duckduckgo_rs |
| lib.rs | duckduckgo_rs |
| version | 0.0.1 |
| created_at | 2025-01-10 05:52:51.400413+00 |
| updated_at | 2025-01-10 05:52:51.400413+00 |
| description | interface to interact with the DuckDuckGo search engine. This library allows you to perform web searches and retrieve search results programmatically. |
| homepage | https://github.com/Himasnhu-AT/duckduckgo_rs/blob/master/Readme.md |
| repository | https://github.com/Himasnhu-AT/duckduckgo_rs.git |
| max_upload_size | |
| id | 1510970 |
| size | 62,560 |
duckduckgo_rs is a Rust library that provides an interface to interact with the DuckDuckGo search engine. This library allows you to perform web searches and retrieve search results programmatically.
Add duckduckgo_rs to your Cargo.toml:
[dependencies]
duckduckgo_rs = "0.0.1"
Here's an example of how to use the duckduckgo_rs library to perform a search:
use anyhow::Result;
use duckduckgo_rs::search_duckduckgo;
use reqwest::Client;
#[tokio::main]
async fn main() -> Result<()> {
let http_client = Client::new();
let query = "rust programming"; // Example query
match search_duckduckgo(&http_client, query).await {
Ok(results) => {
for result in results {
println!("Title: {}", result.title);
println!("Description: {}", result.description);
println!("URL: {}", result.url);
println!();
}
}
Err(e) => {
eprintln!("Error occurred: {}", e);
}
}
Ok(())
}
To run the example, use the following command:
cargo run --example main
To run the tests, use the following command:
cargo test
To generate and open the documentation, use the following command:
cargo doc --open --release
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the terms of the BSD 3-Clause License.