use firecrawl::FirecrawlApp;
#[tokio::main]
async fn main() {
// Initialize the FirecrawlApp with the API key
let api_key = "YOUR_API_KEY";
let api_url = "https://api.firecrawl.dev";
let app = FirecrawlApp::new(api_key, api_url).expect("Failed to initialize FirecrawlApp");
// Crawl the URL
let crawl_params = json!({
"crawlerOptions": {
"excludes": ["blog/*"]
}
});
let crawl_result = app
.crawl_url("https://example.com", Some(crawl_params), true, 2, None)
.await;
// Print the crawl result
match crawl_result {
Ok(data) => println!("Crawl Result:
{}", data),
Err(e) => eprintln!("Crawl failed: {}", e),
}
}