Class: Firecrawl::Models::CrawlOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/firecrawl/models/crawl_options.rb

Overview

Options for crawling a website.

Constant Summary collapse

FIELDS =
%i[
  prompt exclude_paths include_paths max_discovery_depth sitemap
  ignore_query_parameters deduplicate_similar_urls limit
  crawl_entire_domain allow_external_links allow_subdomains
  delay max_concurrency webhook scrape_options regex_on_full_url
  zero_data_retention integration
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ CrawlOptions

Returns a new instance of CrawlOptions.



17
18
19
# File 'lib/firecrawl/models/crawl_options.rb', line 17

def initialize(**kwargs)
  FIELDS.each { |f| instance_variable_set(:"@#{f}", kwargs[f]) }
end

Instance Method Details

#to_hObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/firecrawl/models/crawl_options.rb', line 21

def to_h
  h = {
    "prompt" => prompt,
    "excludePaths" => exclude_paths,
    "includePaths" => include_paths,
    "maxDiscoveryDepth" => max_discovery_depth,
    "sitemap" => sitemap,
    "ignoreQueryParameters" => ignore_query_parameters,
    "deduplicateSimilarURLs" => deduplicate_similar_urls,
    "limit" => limit,
    "crawlEntireDomain" => crawl_entire_domain,
    "allowExternalLinks" => allow_external_links,
    "allowSubdomains" => allow_subdomains,
    "delay" => delay,
    "maxConcurrency" => max_concurrency,
    "webhook" => serialize_webhook,
    "scrapeOptions" => scrape_options&.to_h,
    "regexOnFullURL" => regex_on_full_url,
    "zeroDataRetention" => zero_data_retention,
    "integration" => integration,
  }.compact
  h
end