firecrawl-sdk 1.17.5 → 1.17.7
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 +20 -1
- data/lib/firecrawl/client.rb +22 -4
- data/lib/firecrawl/models/developer_search_options.rb +37 -0
- data/lib/firecrawl/models/developer_search_response.rb +76 -0
- data/lib/firecrawl/version.rb +1 -1
- data/lib/firecrawl.rb +2 -0
- metadata +8 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 22543b5053874d9d1a815949df7212abbcca9a72738a23ecfc696194696b6ad6
|
|
4
|
+
data.tar.gz: a53387ffdbb11b21ce357368f617dd83fdf341619a022db5997b8a4e3bfab6b1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7345b8e668fd1ece22c0de23408a7f99e6e5da42f2a573973cb32b4db18cd5bb2d8f61f505e0de5df4e0a0c96fd11af8c35531cd98bcdaa2aab470227678a9ac
|
|
7
|
+
data.tar.gz: 7a4ec95b23cd3e767e93742600a01c8a51123d9c9589823bf62f6a2fb2561ad77fb05c95a45324e44a0ef7322aea4fcd94a46ce6e3b705f61ec5831901ff27ec
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Firecrawl Ruby SDK
|
|
2
2
|
|
|
3
|
-
Ruby SDK for
|
|
3
|
+
Ruby SDK for [Firecrawl](https://firecrawl.dev), the context API for AI agents. Search, scrape, parse, crawl, map, and interact with the web, and run Agent and Monitor jobs on the v2 API.
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
@@ -193,6 +193,25 @@ results = client.search("latest news",
|
|
|
193
193
|
Firecrawl::Models::SearchOptions.new(limit: 5, location: "US"))
|
|
194
194
|
```
|
|
195
195
|
|
|
196
|
+
### Developer Search
|
|
197
|
+
|
|
198
|
+
Search public repositories, GitHub issues, merged pull requests, READMEs and code documentation. `developer_search` replaces the deprecated `search_github`.
|
|
199
|
+
|
|
200
|
+
```ruby
|
|
201
|
+
response = client.developer_search(
|
|
202
|
+
"retry an http request with exponential backoff",
|
|
203
|
+
Firecrawl::Models::DeveloperSearchOptions.new(
|
|
204
|
+
k: 5,
|
|
205
|
+
types: ["issue", "pull_request"],
|
|
206
|
+
repos: ["square/okhttp"]
|
|
207
|
+
)
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
response.results.each do |result|
|
|
211
|
+
puts "#{result.title} #{result.url}"
|
|
212
|
+
end
|
|
213
|
+
```
|
|
214
|
+
|
|
196
215
|
### Agent
|
|
197
216
|
|
|
198
217
|
```ruby
|
data/lib/firecrawl/client.rb
CHANGED
|
@@ -133,10 +133,9 @@ module Firecrawl
|
|
|
133
133
|
|
|
134
134
|
# Search GitHub research content.
|
|
135
135
|
#
|
|
136
|
-
# @deprecated Stops responding after 2026-11-03. Use
|
|
137
|
-
#
|
|
138
|
-
#
|
|
139
|
-
# web fallback results.
|
|
136
|
+
# @deprecated Stops responding after 2026-11-03. Use {#developer_search},
|
|
137
|
+
# which does not carry over the score breakdown or the web fallback
|
|
138
|
+
# results.
|
|
140
139
|
# @param query_text [String] GitHub query
|
|
141
140
|
# @param options [Hash] optional query parameters
|
|
142
141
|
# @return [Hash]
|
|
@@ -144,6 +143,22 @@ module Firecrawl
|
|
|
144
143
|
@http.get("/v2/search/research/github#{query(options.merge("query" => query_text, "origin" => "ruby-sdk@#{Firecrawl::VERSION}"))}")
|
|
145
144
|
end
|
|
146
145
|
|
|
146
|
+
# Searches the developer index: public repositories, GitHub issues, merged
|
|
147
|
+
# pull requests, READMEs and code documentation.
|
|
148
|
+
#
|
|
149
|
+
# @param query [String] the search query
|
|
150
|
+
# @param options [Models::DeveloperSearchOptions, nil] developer search filters
|
|
151
|
+
# @return [Models::DeveloperSearchResponse]
|
|
152
|
+
# @raise [ArgumentError] if the query is blank
|
|
153
|
+
def developer_search(query, options = nil)
|
|
154
|
+
raise ArgumentError, "Query is required" if query.nil? || query.to_s.strip.empty?
|
|
155
|
+
|
|
156
|
+
body = { "query" => query }
|
|
157
|
+
body.merge!(options.to_h) if options
|
|
158
|
+
body["origin"] ||= "ruby-sdk@#{Firecrawl::VERSION}"
|
|
159
|
+
Models::DeveloperSearchResponse.new(@http.post("/v2/search/developer", body))
|
|
160
|
+
end
|
|
161
|
+
|
|
147
162
|
# Interacts with the scrape-bound browser session for a scrape job.
|
|
148
163
|
#
|
|
149
164
|
# @param job_id [String] the scrape job ID
|
|
@@ -222,6 +237,7 @@ module Firecrawl
|
|
|
222
237
|
|
|
223
238
|
body = { "url" => url }
|
|
224
239
|
body.merge!(options.to_h) if options
|
|
240
|
+
body["origin"] ||= "ruby-sdk@#{Firecrawl::VERSION}"
|
|
225
241
|
raw = @http.post("/v2/crawl", body)
|
|
226
242
|
Models::CrawlResponse.new(raw)
|
|
227
243
|
end
|
|
@@ -296,6 +312,7 @@ module Firecrawl
|
|
|
296
312
|
body.merge!(opts_hash)
|
|
297
313
|
body.merge!(nested) if nested
|
|
298
314
|
end
|
|
315
|
+
body["origin"] ||= "ruby-sdk@#{Firecrawl::VERSION}"
|
|
299
316
|
raw = @http.post("/v2/batch/scrape", body, extra_headers: extra_headers)
|
|
300
317
|
Models::BatchScrapeResponse.new(raw)
|
|
301
318
|
end
|
|
@@ -347,6 +364,7 @@ module Firecrawl
|
|
|
347
364
|
|
|
348
365
|
body = { "url" => url }
|
|
349
366
|
body.merge!(options.to_h) if options
|
|
367
|
+
body["origin"] ||= "ruby-sdk@#{Firecrawl::VERSION}"
|
|
350
368
|
raw = @http.post("/v2/map", body)
|
|
351
369
|
data = raw["data"] || raw
|
|
352
370
|
Models::MapData.new(data)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Firecrawl
|
|
4
|
+
module Models
|
|
5
|
+
# Options for a developer search request. Unset fields are omitted.
|
|
6
|
+
#
|
|
7
|
+
# - k: total ranked results, 1 to 100 (default 10)
|
|
8
|
+
# - passages: passages per result, 1 to 5 (default 1)
|
|
9
|
+
# - types: result kinds, any of "doc", "issue", "pull_request", "readme"
|
|
10
|
+
# - repos: GitHub owner/name filters, at most 20
|
|
11
|
+
# - sources: developer documentation source IDs, at most 20
|
|
12
|
+
# - language: one case-insensitive GitHub Linguist primary language
|
|
13
|
+
# - topic: repository topics that must all match, at most 8
|
|
14
|
+
# - license: one case-insensitive SPDX repository license identifier
|
|
15
|
+
# - min_stars, max_stars, archived, fork: repository filters
|
|
16
|
+
# - skills: "only" returns packaged agent-skill evidence only
|
|
17
|
+
class DeveloperSearchOptions
|
|
18
|
+
FIELDS = %i[
|
|
19
|
+
k passages types repos sources language topic license
|
|
20
|
+
min_stars max_stars archived fork skills
|
|
21
|
+
].freeze
|
|
22
|
+
|
|
23
|
+
attr_reader(*FIELDS)
|
|
24
|
+
|
|
25
|
+
def initialize(**kwargs)
|
|
26
|
+
unknown = kwargs.keys - FIELDS
|
|
27
|
+
raise ArgumentError, "unknown developer search option(s): #{unknown.join(", ")}" unless unknown.empty?
|
|
28
|
+
|
|
29
|
+
FIELDS.each { |f| instance_variable_set(:"@#{f}", kwargs[f]) }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def to_h
|
|
33
|
+
FIELDS.to_h { |f| [f.to_s, public_send(f)] }.compact
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Firecrawl
|
|
4
|
+
module Models
|
|
5
|
+
# One matched passage of a developer search result.
|
|
6
|
+
class DeveloperSearchPassage
|
|
7
|
+
attr_reader :text, :citation_url
|
|
8
|
+
|
|
9
|
+
def initialize(data)
|
|
10
|
+
@text = data["text"]
|
|
11
|
+
@citation_url = data["citation_url"]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# One ranked developer search result. `license` is either an SPDX string or
|
|
16
|
+
# a disclosure object (Hash), so it is kept as returned.
|
|
17
|
+
class DeveloperSearchResult
|
|
18
|
+
attr_reader :id, :url, :title, :passages, :license
|
|
19
|
+
|
|
20
|
+
def initialize(data)
|
|
21
|
+
@id = data["id"]
|
|
22
|
+
@url = data["url"]
|
|
23
|
+
@title = data["title"]
|
|
24
|
+
@passages = (data["passages"] || []).map { |p| DeveloperSearchPassage.new(p) }
|
|
25
|
+
@license = data["license"]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Whether a requested repository is indexed, and which result types it has.
|
|
30
|
+
class DeveloperSearchRepoStatus
|
|
31
|
+
attr_reader :repo, :indexed, :types
|
|
32
|
+
|
|
33
|
+
def initialize(data)
|
|
34
|
+
@repo = data["repo"]
|
|
35
|
+
@indexed = data["indexed"] == true
|
|
36
|
+
@types = data["types"] || {}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def indexed?
|
|
40
|
+
indexed
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Whether a requested documentation source is indexed.
|
|
45
|
+
class DeveloperSearchSourceStatus
|
|
46
|
+
attr_reader :source, :indexed
|
|
47
|
+
|
|
48
|
+
def initialize(data)
|
|
49
|
+
@source = data["source"]
|
|
50
|
+
@indexed = data["indexed"] == true
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def indexed?
|
|
54
|
+
indexed
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Response from a developer search. `repos` and `sources` are present only
|
|
59
|
+
# when those filters were requested.
|
|
60
|
+
class DeveloperSearchResponse
|
|
61
|
+
attr_reader :success, :partial, :results, :repos, :sources
|
|
62
|
+
|
|
63
|
+
def initialize(data)
|
|
64
|
+
@success = data["success"] == true
|
|
65
|
+
@partial = data["partial"] == true
|
|
66
|
+
@results = (data["results"] || []).map { |r| DeveloperSearchResult.new(r) }
|
|
67
|
+
@repos = data["repos"]&.map { |r| DeveloperSearchRepoStatus.new(r) }
|
|
68
|
+
@sources = data["sources"]&.map { |s| DeveloperSearchSourceStatus.new(s) }
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def to_s
|
|
72
|
+
"DeveloperSearchResponse{results=#{results.size}}"
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
data/lib/firecrawl/version.rb
CHANGED
data/lib/firecrawl.rb
CHANGED
|
@@ -20,6 +20,8 @@ require_relative "firecrawl/models/map_options"
|
|
|
20
20
|
require_relative "firecrawl/models/map_data"
|
|
21
21
|
require_relative "firecrawl/models/search_options"
|
|
22
22
|
require_relative "firecrawl/models/search_data"
|
|
23
|
+
require_relative "firecrawl/models/developer_search_options"
|
|
24
|
+
require_relative "firecrawl/models/developer_search_response"
|
|
23
25
|
require_relative "firecrawl/models/parse_file"
|
|
24
26
|
require_relative "firecrawl/models/parse_options"
|
|
25
27
|
require_relative "firecrawl/models/parse_format"
|
metadata
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: firecrawl-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.17.
|
|
4
|
+
version: 1.17.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Firecrawl
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
|
-
description: A type-safe Ruby client for the Firecrawl v2 API
|
|
14
|
-
|
|
13
|
+
description: 'A type-safe Ruby client for the Firecrawl v2 API: search, scrape, parse,
|
|
14
|
+
crawl, map, and interact with the web, run batch scrapes, and run Agent and Monitor
|
|
15
|
+
jobs.'
|
|
15
16
|
email:
|
|
16
17
|
- hello@firecrawl.dev
|
|
17
18
|
executables: []
|
|
@@ -42,6 +43,8 @@ files:
|
|
|
42
43
|
- lib/firecrawl/models/crawl_options.rb
|
|
43
44
|
- lib/firecrawl/models/crawl_response.rb
|
|
44
45
|
- lib/firecrawl/models/credit_usage.rb
|
|
46
|
+
- lib/firecrawl/models/developer_search_options.rb
|
|
47
|
+
- lib/firecrawl/models/developer_search_response.rb
|
|
45
48
|
- lib/firecrawl/models/document.rb
|
|
46
49
|
- lib/firecrawl/models/map_data.rb
|
|
47
50
|
- lib/firecrawl/models/map_options.rb
|
|
@@ -83,5 +86,5 @@ requirements: []
|
|
|
83
86
|
rubygems_version: 3.5.22
|
|
84
87
|
signing_key:
|
|
85
88
|
specification_version: 4
|
|
86
|
-
summary: Ruby SDK for the
|
|
89
|
+
summary: Ruby SDK for Firecrawl, the context API for AI agents
|
|
87
90
|
test_files: []
|