firecrawl-sdk 1.9.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -0
- data/lib/firecrawl/models/document.rb +2 -1
- data/lib/firecrawl/models/menu_profile.rb +114 -0
- data/lib/firecrawl/models/monitor.rb +75 -0
- data/lib/firecrawl/models/parse_options.rb +2 -2
- data/lib/firecrawl/models/search_options.rb +4 -1
- data/lib/firecrawl/version.rb +1 -1
- data/lib/firecrawl.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fc48fdfecc01e4811b2634c740ffab0787e03f99001a401014a3e98b0e63f627
|
|
4
|
+
data.tar.gz: ad7b3330c7e5f0934c58747ad2748b737783b90d4ccbf732d6f60924543bf45d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75d9dde872641f95f313555ee32c842295c1a4afd150e1158b256821cf5a61f21078c80003b96ef86bce189c8909de1053bbad00a53907b5c191368b1af94444
|
|
7
|
+
data.tar.gz: 87b0802113b459ead84ea99a1b3a3aa989c26bf1c55b98dd567e7a2e669a38f52a9205a0924b5c1824e8078f61ab472d2f12a471dabfd7a86b445892914c061e
|
data/README.md
CHANGED
|
@@ -88,6 +88,21 @@ doc = client.scrape("https://example.com/products/widget",
|
|
|
88
88
|
puts doc.product
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
+
### Menu Extraction
|
|
92
|
+
|
|
93
|
+
Use the `menu` format on restaurant/merchant menu pages to get structured
|
|
94
|
+
menu data (merchant profile plus ordered sections, each holding items with
|
|
95
|
+
per-item price, availability, images, and dietary information). It is the
|
|
96
|
+
deterministic counterpart to the LLM-based `json` format. The returned `menu`
|
|
97
|
+
field contains the extracted fields.
|
|
98
|
+
|
|
99
|
+
```ruby
|
|
100
|
+
doc = client.scrape("https://example.com/menu",
|
|
101
|
+
Firecrawl::Models::ScrapeOptions.new(formats: ["menu"]))
|
|
102
|
+
|
|
103
|
+
puts doc.menu
|
|
104
|
+
```
|
|
105
|
+
|
|
91
106
|
### Parse
|
|
92
107
|
|
|
93
108
|
Upload a local file (`html`, `pdf`, `docx`, etc.) via multipart form data and
|
|
@@ -7,7 +7,7 @@ module Firecrawl
|
|
|
7
7
|
attr_reader :markdown, :html, :raw_html, :json, :summary,
|
|
8
8
|
:metadata, :links, :images, :screenshot, :audio,
|
|
9
9
|
:video, :attributes, :actions, :answer, :highlights,
|
|
10
|
-
:warning, :change_tracking, :branding, :product
|
|
10
|
+
:warning, :change_tracking, :branding, :product, :menu
|
|
11
11
|
|
|
12
12
|
def initialize(data)
|
|
13
13
|
@markdown = data["markdown"]
|
|
@@ -29,6 +29,7 @@ module Firecrawl
|
|
|
29
29
|
@change_tracking = data["changeTracking"]
|
|
30
30
|
@branding = data["branding"]
|
|
31
31
|
@product = data["product"] && ProductProfile.new(data["product"])
|
|
32
|
+
@menu = data["menu"] && MenuProfile.new(data["menu"])
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
def to_s
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Firecrawl
|
|
4
|
+
module Models
|
|
5
|
+
# Structured menu information extracted from a restaurant/merchant page
|
|
6
|
+
# via the `menu` scrape format.
|
|
7
|
+
class MenuProfile
|
|
8
|
+
# An image associated with a menu item.
|
|
9
|
+
class Image
|
|
10
|
+
attr_reader :url, :alt
|
|
11
|
+
|
|
12
|
+
def initialize(data)
|
|
13
|
+
@url = data["url"]
|
|
14
|
+
@alt = data["alt"]
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# A monetary value with an optional currency and formatted string.
|
|
19
|
+
class Price
|
|
20
|
+
attr_reader :amount, :currency, :formatted
|
|
21
|
+
|
|
22
|
+
def initialize(data)
|
|
23
|
+
@amount = data["amount"]
|
|
24
|
+
@currency = data["currency"]
|
|
25
|
+
@formatted = data["formatted"]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Stock availability information for a menu item. Always present.
|
|
30
|
+
class Availability
|
|
31
|
+
attr_reader :in_stock, :text
|
|
32
|
+
|
|
33
|
+
def initialize(data)
|
|
34
|
+
data ||= {}
|
|
35
|
+
@in_stock = data["inStock"] || false
|
|
36
|
+
@text = data["text"]
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Merchant (restaurant/business) profile for the menu.
|
|
41
|
+
class Merchant
|
|
42
|
+
attr_reader :name, :type, :location
|
|
43
|
+
|
|
44
|
+
def initialize(data)
|
|
45
|
+
data ||= {}
|
|
46
|
+
@name = data["name"]
|
|
47
|
+
@type = data["type"]
|
|
48
|
+
@location = data["location"]
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Identifiers carried on a menu item.
|
|
53
|
+
class Identifiers
|
|
54
|
+
attr_reader :merchant_item_id
|
|
55
|
+
|
|
56
|
+
def initialize(data)
|
|
57
|
+
data ||= {}
|
|
58
|
+
@merchant_item_id = data["merchantItemId"]
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# A single item on the menu. Pricing, availability, images, and dietary
|
|
63
|
+
# information live here rather than on the section or profile.
|
|
64
|
+
class Item
|
|
65
|
+
attr_reader :id, :name, :description, :images, :price, :availability,
|
|
66
|
+
:dietary, :calories, :option_groups, :identifiers, :url,
|
|
67
|
+
:source_url
|
|
68
|
+
|
|
69
|
+
def initialize(data)
|
|
70
|
+
@id = data["id"]
|
|
71
|
+
@name = data["name"]
|
|
72
|
+
@description = data["description"]
|
|
73
|
+
@images = (data["images"] || []).map { |img| Image.new(img) }
|
|
74
|
+
@price = data["price"] && Price.new(data["price"])
|
|
75
|
+
@availability = Availability.new(data["availability"])
|
|
76
|
+
@dietary = data["dietary"] || []
|
|
77
|
+
@calories = data["calories"]
|
|
78
|
+
@option_groups = data["optionGroups"] || []
|
|
79
|
+
@identifiers = Identifiers.new(data["identifiers"])
|
|
80
|
+
@url = data["url"]
|
|
81
|
+
@source_url = data["sourceUrl"]
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# An ordered group of menu items.
|
|
86
|
+
class Section
|
|
87
|
+
attr_reader :id, :name, :description, :items
|
|
88
|
+
|
|
89
|
+
def initialize(data)
|
|
90
|
+
@id = data["id"]
|
|
91
|
+
@name = data["name"]
|
|
92
|
+
@description = data["description"]
|
|
93
|
+
@items = (data["items"] || []).map { |item| Item.new(item) }
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
attr_reader :is_menu, :confidence, :merchant, :currency, :sections,
|
|
98
|
+
:source_url
|
|
99
|
+
|
|
100
|
+
def initialize(data)
|
|
101
|
+
@is_menu = data["isMenu"] || false
|
|
102
|
+
@confidence = data["confidence"]
|
|
103
|
+
@merchant = Merchant.new(data["merchant"])
|
|
104
|
+
@currency = data["currency"]
|
|
105
|
+
@sections = (data["sections"] || []).map { |section| Section.new(section) }
|
|
106
|
+
@source_url = data["sourceUrl"]
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def to_s
|
|
110
|
+
"MenuProfile{merchant=#{merchant&.name || 'unknown'}, sourceUrl=#{source_url || 'unknown'}}"
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
@@ -2,6 +2,81 @@
|
|
|
2
2
|
|
|
3
3
|
module Firecrawl
|
|
4
4
|
module Models
|
|
5
|
+
# A scrape, crawl, or search target stored on a monitor.
|
|
6
|
+
#
|
|
7
|
+
# Targets are forwarded to the API verbatim, so callers may also pass
|
|
8
|
+
# plain Hashes with camelCase keys. This class is a convenience for
|
|
9
|
+
# building well-formed target payloads (and is what {#to_h} emits).
|
|
10
|
+
#
|
|
11
|
+
# Search targets (+type: "search"+) use the +queries+, +search_window+,
|
|
12
|
+
# +include_domains+, +exclude_domains+, and +max_results+ fields.
|
|
13
|
+
class MonitorTarget
|
|
14
|
+
attr_reader :id, :type, :urls, :url, :scrape_options, :crawl_options,
|
|
15
|
+
:queries, :search_window, :include_domains,
|
|
16
|
+
:exclude_domains, :max_results
|
|
17
|
+
|
|
18
|
+
def initialize(data)
|
|
19
|
+
@id = data["id"]
|
|
20
|
+
@type = data["type"]
|
|
21
|
+
@urls = data["urls"]
|
|
22
|
+
@url = data["url"]
|
|
23
|
+
@scrape_options = data["scrapeOptions"]
|
|
24
|
+
@crawl_options = data["crawlOptions"]
|
|
25
|
+
# search target fields
|
|
26
|
+
@queries = data["queries"]
|
|
27
|
+
@search_window = data["searchWindow"]
|
|
28
|
+
@include_domains = data["includeDomains"]
|
|
29
|
+
@exclude_domains = data["excludeDomains"]
|
|
30
|
+
@max_results = data["maxResults"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def to_h
|
|
34
|
+
{
|
|
35
|
+
"id" => @id,
|
|
36
|
+
"type" => @type,
|
|
37
|
+
"urls" => @urls,
|
|
38
|
+
"url" => @url,
|
|
39
|
+
"scrapeOptions" => @scrape_options,
|
|
40
|
+
"crawlOptions" => @crawl_options,
|
|
41
|
+
"queries" => @queries,
|
|
42
|
+
"searchWindow" => @search_window,
|
|
43
|
+
"includeDomains" => @include_domains,
|
|
44
|
+
"excludeDomains" => @exclude_domains,
|
|
45
|
+
"maxResults" => @max_results,
|
|
46
|
+
}.compact
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# A per-target result on a monitor check.
|
|
51
|
+
#
|
|
52
|
+
# Search targets (+type: "search"+) populate the +search_completed+,
|
|
53
|
+
# +result_count+, +matches+, +summary+, +judge_degraded+,
|
|
54
|
+
# +degraded_reason+, +search_credits+, +judge_credits+, and
|
|
55
|
+
# +results_judged+ fields.
|
|
56
|
+
class MonitorTargetResult
|
|
57
|
+
attr_reader :target_id, :type, :expected_jobs, :crawl_id,
|
|
58
|
+
:search_completed, :result_count, :matches, :summary,
|
|
59
|
+
:judge_degraded, :degraded_reason, :search_credits,
|
|
60
|
+
:judge_credits, :results_judged
|
|
61
|
+
|
|
62
|
+
def initialize(data)
|
|
63
|
+
@target_id = data["targetId"]
|
|
64
|
+
@type = data["type"]
|
|
65
|
+
@expected_jobs = data["expectedJobs"]
|
|
66
|
+
@crawl_id = data["crawlId"]
|
|
67
|
+
# search target result fields
|
|
68
|
+
@search_completed = data["searchCompleted"]
|
|
69
|
+
@result_count = data["resultCount"]
|
|
70
|
+
@matches = data["matches"]
|
|
71
|
+
@summary = data["summary"]
|
|
72
|
+
@judge_degraded = data["judgeDegraded"]
|
|
73
|
+
@degraded_reason = data["degradedReason"]
|
|
74
|
+
@search_credits = data["searchCredits"]
|
|
75
|
+
@judge_credits = data["judgeCredits"]
|
|
76
|
+
@results_judged = data["resultsJudged"]
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
5
80
|
class Monitor
|
|
6
81
|
attr_reader :id, :name, :status, :schedule, :next_run_at, :last_run_at,
|
|
7
82
|
:current_check_id, :targets, :webhook, :notification,
|
|
@@ -5,10 +5,10 @@ module Firecrawl
|
|
|
5
5
|
# Options for parsing uploaded files via `/v2/parse`.
|
|
6
6
|
#
|
|
7
7
|
# Parse does not support browser-rendering features (actions, waitFor,
|
|
8
|
-
# location, mobile) nor screenshot/branding/product/audio/video/changeTracking formats. The
|
|
8
|
+
# location, mobile) nor screenshot/branding/product/menu/audio/video/changeTracking formats. The
|
|
9
9
|
# proxy field only accepts "auto" or "basic".
|
|
10
10
|
class ParseOptions
|
|
11
|
-
UNSUPPORTED_FORMATS = %w[changeTracking screenshot screenshot@fullPage branding product audio video].freeze
|
|
11
|
+
UNSUPPORTED_FORMATS = %w[changeTracking screenshot screenshot@fullPage branding product menu audio video].freeze
|
|
12
12
|
|
|
13
13
|
FIELDS = %i[
|
|
14
14
|
formats headers include_tags exclude_tags only_main_content
|
|
@@ -6,7 +6,7 @@ module Firecrawl
|
|
|
6
6
|
class SearchOptions
|
|
7
7
|
FIELDS = %i[
|
|
8
8
|
sources categories include_domains exclude_domains limit tbs location
|
|
9
|
-
ignore_invalid_urls timeout scrape_options integration
|
|
9
|
+
ignore_invalid_urls timeout scrape_options integration enterprise
|
|
10
10
|
].freeze
|
|
11
11
|
|
|
12
12
|
attr_reader(*FIELDS)
|
|
@@ -28,6 +28,9 @@ module Firecrawl
|
|
|
28
28
|
"timeout" => timeout,
|
|
29
29
|
"scrapeOptions" => scrape_options&.to_h,
|
|
30
30
|
"integration" => integration,
|
|
31
|
+
# Enterprise search options. Use ["zdr"] for end-to-end Zero Data
|
|
32
|
+
# Retention or ["anon"] for anonymized search. Must be enabled for your team.
|
|
33
|
+
"enterprise" => enterprise,
|
|
31
34
|
}.compact
|
|
32
35
|
end
|
|
33
36
|
end
|
data/lib/firecrawl/version.rb
CHANGED
data/lib/firecrawl.rb
CHANGED
|
@@ -5,6 +5,7 @@ require_relative "firecrawl/errors"
|
|
|
5
5
|
require_relative "firecrawl/http_client"
|
|
6
6
|
require_relative "firecrawl/models/query_format"
|
|
7
7
|
require_relative "firecrawl/models/product_profile"
|
|
8
|
+
require_relative "firecrawl/models/menu_profile"
|
|
8
9
|
require_relative "firecrawl/models/document"
|
|
9
10
|
require_relative "firecrawl/models/scrape_options"
|
|
10
11
|
require_relative "firecrawl/models/crawl_options"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: firecrawl-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Firecrawl
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A type-safe Ruby client for the Firecrawl v2 API. Supports scraping,
|
|
14
14
|
crawling, batch scraping, URL mapping, web search, and AI agent operations.
|
|
@@ -38,6 +38,7 @@ files:
|
|
|
38
38
|
- lib/firecrawl/models/document.rb
|
|
39
39
|
- lib/firecrawl/models/map_data.rb
|
|
40
40
|
- lib/firecrawl/models/map_options.rb
|
|
41
|
+
- lib/firecrawl/models/menu_profile.rb
|
|
41
42
|
- lib/firecrawl/models/monitor.rb
|
|
42
43
|
- lib/firecrawl/models/parse_file.rb
|
|
43
44
|
- lib/firecrawl/models/parse_options.rb
|