firecrawl

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FirecrawlAPIBaseURL = "https://api.firecrawl.dev/v1/scrape"
	DefaultTimeout      = 90 * time.Second
)

Constants for the Firecrawl adapter.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client for the Firecrawl API.

func NewClient

func NewClient(config *ClientConfig) *Client

NewClient creates a new Firecrawl client.

func (*Client) Scrape

func (c *Client) Scrape(ctx context.Context, targetURL string, options *web.ScrapeOptions) (*web.WebContent, error)

Scrape implements the web.WebAdapter interface for a single URL.

func (*Client) ScrapeMultiple

func (c *Client) ScrapeMultiple(ctx context.Context, urls []string, options *web.ScrapeOptions) ([]*web.WebContent, error)

ScrapeMultiple implements the web.WebAdapter interface for multiple URLs.

type ClientConfig

type ClientConfig struct {
	APIKey     string        `json:"api_key"`
	BaseURL    string        `json:"base_url,omitempty"`
	Timeout    time.Duration `json:"timeout,omitempty"`
	HTTPClient *http.Client  `json:"-"`
}

ClientConfig holds the configuration for the Firecrawl client.

type ExtractorOptions

type ExtractorOptions struct {
	Mode             string `json:"mode,omitempty"` // e.g., "llm-extraction"
	ExtractionPrompt string `json:"extractionPrompt,omitempty"`
}

ExtractorOptions defines what to extract from the page.

type FirecrawlAdapterCreator

type FirecrawlAdapterCreator struct{}

FirecrawlAdapterCreator creates Firecrawl adapter instances.

func (*FirecrawlAdapterCreator) CreateAdapter

func (c *FirecrawlAdapterCreator) CreateAdapter(scraperConfig types.WebScraperConfig) (web.WebAdapter, error)

CreateAdapter creates a new Firecrawl adapter.

type PageOptions

type PageOptions struct {
	Screenshots bool `json:"screenshots,omitempty"`
	WaitFor     int  `json:"waitFor,omitempty"` // in milliseconds
}

PageOptions defines page-specific options for scraping.

type ScrapeData

type ScrapeData struct {
	Content     string                 `json:"content"`
	Markdown    string                 `json:"markdown"`
	HTML        string                 `json:"html"`
	Title       string                 `json:"title"`
	Description string                 `json:"description"`
	URL         string                 `json:"url"`
	Metadata    map[string]interface{} `json:"metadata"`
}

ScrapeData contains the actual scraped content.

type ScrapeRequest

type ScrapeRequest struct {
	URL              string            `json:"url"`
	PageOptions      *PageOptions      `json:"pageOptions,omitempty"`
	ExtractorOptions *ExtractorOptions `json:"extractorOptions,omitempty"`
}

ScrapeRequest defines the request body for the /v0/scrape endpoint.

type ScrapeResponse

type ScrapeResponse struct {
	Success bool        `json:"success"`
	Data    *ScrapeData `json:"data"`
}

ScrapeResponse defines the successful response from the /v0/scrape endpoint.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL