#kagi #search #kagisearch

kagisearch

A Rust library that allows you to perform Kagi searches programmatically using chromiumoxide, without consuming additional API credits

4 releases (2 breaking)

Uses new Rust 2024

0.3.0 Mar 25, 2025
0.2.1 Mar 24, 2025
0.2.0 Mar 24, 2025
0.1.0 Mar 23, 2025

#212 in Authentication

Download history 206/week @ 2025-03-19 64/week @ 2025-03-26

270 downloads per month

Apache-2.0

28KB
414 lines

Kagi Search 🔍

Behavior Test Crates.io Documentation License

A Rust library that allows you to perform Kagi searches programmatically using chromiumoxide, without consuming additional API credits.

✨ Features

  • 💳 No additional API credits required
  • 🔐 Supports token-based, F2A-based and cookie-based authentication
  • 🕵️ Incognito mode allows you to perform searches without saving your authentication.

📦 Installation

Add kagisearch to your Cargo.toml:

[dependencies]
kagisearch = "0.3"

async-std users should use the async-std-runtime feature:

[dependencies]
kagisearch = { version = "0.3", features = ["async-std-runtime"], default-features = false }

🚀 Quick Start

use kagisearch::{AuthType, Kagi};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Initialize the browser with your Kagi token
    let kagi = Kagi::new(AuthType::Token("your_token_here".to_string())).await?;
    // Perform a search and get up to 5 results
    let results = kagi.search("Rust programming language", 5, None).await?;

    let Some(results) = results else {
        return Err(anyhow::anyhow!("No search results found"));
    };

    // Print the results
    for result in results {
        println!("{:?}", result);
    }

    kagi.close().await?;

    Ok(())
}

📖 Documentation

For more detailed examples and usage instructions, check out:

🤝 Contributing

Contributions are welcome! Feel free to:

  1. Fork the repository
  2. Create a new branch for your feature
  3. Submit a Pull Request

Please make sure to update tests as appropriate.

Credits

⚖️ License

This project is licensed under the Apache License.

📝 Note

While Kagi is an excellent search engine, their API pricing can be cost-prohibitive. This library provides a way to integrate Kagi search functionality into your applications without incurring additional API costs beyond your Professional subscription.

Dependencies

~15–30MB
~499K SLoC