Skip to content

Commit

Permalink
Update README.me with examples
Browse files Browse the repository at this point in the history
  • Loading branch information
rudrankriyam committed Oct 15, 2024
1 parent 8698ad1 commit 78e46b0
Showing 1 changed file with 59 additions and 7 deletions.
66 changes: 59 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# AgniKit: Unofficial Swift SDK for Firecrawl 🔥
# **AgniKit: Unofficial Swift SDK for Firecrawl 🔥**

AgniKit is the unofficial Swift SDK for the Firecrawl API. It provides a simple way to integrate Firecrawl's web scraping and crawling capabilities into your Swift projects for prototyping and development.

Agni (अग्नि) is the Sanskrit word for "fire", which aligns with the "fire" theme of Firecrawl. In Hindu mythology, Agni is also the god of fire, representing power and purification.

## Features
## **Features**

- One line Swift APIs for Firecrawl API
- Support for scraping, crawling, and data extraction
- Swift concurrency

## Installation
## **Installation**

Add the following to your `Package.swift` file:

Expand All @@ -20,7 +20,7 @@ dependencies: [
]
```

## Quick Start
## **Quick Start**

```swift
import AgniKit
Expand All @@ -29,17 +29,69 @@ let agniKit = AgniKit(apiKey: "your-api-key")

do {
let result = try await agniKit.scrape(url: "https://example.com")
print(result.markdown)
print(result)
} catch {
print("Error: \(error)")
}
```

## Contributing
## **Examples**

### Scraping a webpage

```swift
let result = try await agniKit.scrape(
url: "https://example.com",
formats: ["markdown", "html"],
onlyMainContent: true,
includeTags: ["p", "h1", "h2"],
excludeTags: ["script", "style"],
timeout: 60000
)
print(result)
```

### Crawling a website

```swift
let crawlJob = try await agniKit.crawl(
url: "https://example.com",
maxDepth: 3,
limit: 100,
allowExternalLinks: false,
scrapeOptions: ["formats": ["markdown"]]
)
print("Crawl job started: \(crawlJob)")

// Check crawl status
let status = try await agniKit.getCrawlStatus(id: crawlJob["id"] as! String)
print("Crawl status: \(status)")
```

### Mapping a website

```swift
let mapResult = try await agniKit.map(
url: "https://example.com",
search: "product",
includeSubdomains: true,
limit: 1000
)
print("Mapped links: \(mapResult["links"] as! [String])")
```

### Canceling a crawl job

```swift
let cancelResult = try await agniKit.cancelCrawl(id: "crawl-job-id")
print("Crawl job canceled: \(cancelResult)")
```

## **Contributing**

Contributions are welcome! Please feel free to submit a Pull Request.

## License
## **License**

AgniKit is available under the MIT license. See the LICENSE file for more info.

Expand Down

0 comments on commit 78e46b0

Please sign in to comment.