chore: update doc and libs
This commit is contained in:
@@ -21,10 +21,7 @@ serde_json = "^1.0"
|
|||||||
log = "^0.4"
|
log = "^0.4"
|
||||||
thiserror = "^1.0"
|
thiserror = "^1.0"
|
||||||
uuid = { version = "^1.10", features = ["v4"] }
|
uuid = { version = "^1.10", features = ["v4"] }
|
||||||
|
tokio = { version = "^1", features = ["full"] }
|
||||||
[dependencies.tokio]
|
|
||||||
version = "1"
|
|
||||||
features = ["full"]
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
clippy = "^0.0.302"
|
clippy = "^0.0.302"
|
||||||
|
|||||||
+16
-10
@@ -8,9 +8,18 @@ To install the Firecrawl Rust SDK, add the following to your `Cargo.toml`:
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
firecrawl_rs = "0.1"
|
firecrawl_rs = "^0.1"
|
||||||
|
tokio = { version = "^1", features = ["full"] }
|
||||||
|
serde = { version = "^1.0", features = ["derive"] }
|
||||||
|
serde_json = "^1.0"
|
||||||
|
uuid = { version = "^1.10", features = ["v4"] }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
tokio = { version = "1", features = ["full"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To add it in your codebase.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
1. Get an API key from [firecrawl.dev](https://firecrawl.dev)
|
1. Get an API key from [firecrawl.dev](https://firecrawl.dev)
|
||||||
@@ -37,6 +46,7 @@ async fn main() {
|
|||||||
To scrape a single URL, use the `scrape_url` method. It takes the URL as a parameter and returns the scraped data as a `serde_json::Value`.
|
To scrape a single URL, use the `scrape_url` method. It takes the URL as a parameter and returns the scraped data as a `serde_json::Value`.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
// Example scrape code...
|
||||||
let scrape_result = app.scrape_url("https://example.com", None).await;
|
let scrape_result = app.scrape_url("https://example.com", None).await;
|
||||||
match scrape_result {
|
match scrape_result {
|
||||||
Ok(data) => println!("Scrape Result:\n{}", data["markdown"]),
|
Ok(data) => println!("Scrape Result:\n{}", data["markdown"]),
|
||||||
@@ -82,6 +92,7 @@ let llm_extraction_params = json!({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Example scrape code...
|
||||||
let llm_extraction_result = app
|
let llm_extraction_result = app
|
||||||
.scrape_url("https://news.ycombinator.com", Some(llm_extraction_params))
|
.scrape_url("https://news.ycombinator.com", Some(llm_extraction_params))
|
||||||
.await;
|
.await;
|
||||||
@@ -119,6 +130,8 @@ let crawl_params = json!({
|
|||||||
"excludes": ["blog/*"]
|
"excludes": ["blog/*"]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Example crawl code...
|
||||||
let crawl_result = app
|
let crawl_result = app
|
||||||
.crawl_url("https://example.com", Some(crawl_params), true, 2, idempotency_key)
|
.crawl_url("https://example.com", Some(crawl_params), true, 2, idempotency_key)
|
||||||
.await;
|
.await;
|
||||||
@@ -154,16 +167,9 @@ To ensure the functionality of the Firecrawl Rust SDK, we have included end-to-e
|
|||||||
### Running the Tests
|
### Running the Tests
|
||||||
|
|
||||||
To run the tests, execute the following commands:
|
To run the tests, execute the following commands:
|
||||||
|
|
||||||
Install the test dependencies:
|
|
||||||
```bash
|
```bash
|
||||||
cargo install --dev
|
$ export $(xargs < ./tests/.env)
|
||||||
```
|
$ cargo test --test e2e_with_auth
|
||||||
|
|
||||||
Run:
|
|
||||||
```bash
|
|
||||||
export $(xargs < ./tests/.env)
|
|
||||||
cargo test --test e2e_with_auth
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|||||||
Reference in New Issue
Block a user