Class: Firecrawl::Models::ParseOptions

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

Overview

Options for parsing uploaded files via ‘/v2/parse`.

Parse does not support browser-rendering features (actions, waitFor, location, mobile) nor screenshot/branding/changeTracking formats. The proxy field only accepts “auto” or “basic”.

Constant Summary collapse

UNSUPPORTED_FORMATS =
%w[changeTracking screenshot screenshot@fullPage branding].freeze
FIELDS =
%i[
  formats headers include_tags exclude_tags only_main_content
  timeout parsers skip_tls_verification remove_base64_images
  block_ads proxy integration json_options
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ ParseOptions

Returns a new instance of ParseOptions.



21
22
23
24
25
# File 'lib/firecrawl/models/parse_options.rb', line 21

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

  validate!
end

Instance Method Details

#to_hObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/firecrawl/models/parse_options.rb', line 27

def to_h
  {
    "formats" => formats,
    "headers" => headers,
    "includeTags" => include_tags,
    "excludeTags" => exclude_tags,
    "onlyMainContent" => only_main_content,
    "timeout" => timeout,
    "parsers" => parsers,
    "skipTlsVerification" => skip_tls_verification,
    "removeBase64Images" => remove_base64_images,
    "blockAds" => block_ads,
    "proxy" => proxy,
    "integration" => integration,
    "jsonOptions" => json_options.is_a?(Hash) ? json_options : json_options&.to_h,
  }.compact
end