Skip to content

Commit 4a93721

Browse files
committed
new search action
1 parent 27ae00a commit 4a93721

File tree

3 files changed

+120
-3
lines changed

3 files changed

+120
-3
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
import firecrawl from "../../firecrawl.app.mjs";
2+
3+
export default {
4+
key: "firecrawl-search",
5+
name: "Search",
6+
description: "Search the web and get full content from results. [See the documentation](https://docs.firecrawl.dev/features/search)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
firecrawl,
11+
query: {
12+
type: "string",
13+
label: "Query",
14+
description: "The query to search for",
15+
},
16+
scrapeOptionFormats: {
17+
type: "string[]",
18+
label: "Scrape Option Formats",
19+
description: "Search with content scraping. You can specify multiple output formats.",
20+
options: [
21+
{
22+
label: "Clean, formatted markdown content",
23+
value: "markdown",
24+
},
25+
{
26+
label: "Processed HTML content",
27+
value: "html",
28+
},
29+
{
30+
label: "Unmodified HTML content",
31+
value: "rawHtml",
32+
},
33+
{
34+
label: "List of links found on the page",
35+
value: "links",
36+
},
37+
{
38+
label: "Screenshot of the page",
39+
value: "screenshot",
40+
},
41+
{
42+
label: "Full-page screenshot",
43+
value: "screenshot@fullPage",
44+
},
45+
{
46+
label: "Structured data extraction",
47+
value: "extract",
48+
},
49+
],
50+
optional: true,
51+
},
52+
timeBasedSearch: {
53+
type: "string",
54+
label: "Time Based Search",
55+
description: "Filter the results by time",
56+
options: [
57+
{
58+
label: "Past hour",
59+
value: "qdr:h",
60+
},
61+
{
62+
label: "Past 24 hours",
63+
value: "qdr:d",
64+
},
65+
{
66+
label: "Past week",
67+
value: "qdr:w",
68+
},
69+
{
70+
label: "Past month",
71+
value: "qdr:m",
72+
},
73+
{
74+
label: "Past year",
75+
value: "qdr:y",
76+
},
77+
],
78+
optional: true,
79+
},
80+
customTimeout: {
81+
type: "integer",
82+
label: "Custom Timeout",
83+
description: "Set a custom timeout for search operations. E.g. `30000`",
84+
optional: true,
85+
},
86+
maxResults: {
87+
type: "integer",
88+
label: "Max Results",
89+
description: "The maximum number of results to return",
90+
default: 10,
91+
optional: true,
92+
},
93+
},
94+
async run({ $ }) {
95+
const results = await this.firecrawl.search({
96+
data: {
97+
query: this.query,
98+
limit: this.maxResults,
99+
scrapeOptions: this.scrapeOptionFormats
100+
? {
101+
formats: this.scrapeOptionFormats,
102+
}
103+
: undefined,
104+
tbs: this.timeBasedSearch,
105+
timeout: this.customTimeout,
106+
},
107+
});
108+
$.export("$summary", `Successfully searched for ${this.query}`);
109+
return results;
110+
},
111+
};

components/firecrawl/firecrawl.app.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,12 @@ export default {
7777
...opts,
7878
});
7979
},
80+
search(opts = {}) {
81+
return this._makeRequest({
82+
method: "POST",
83+
path: "/search",
84+
...opts,
85+
});
86+
},
8087
},
8188
};

components/firecrawl/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/firecrawl",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "Pipedream FireCrawl Components",
55
"main": "firecrawl.app.mjs",
66
"keywords": [
@@ -13,7 +13,6 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^3.0.0"
16+
"@pipedream/platform": "^3.1.0"
1717
}
1818
}
19-

0 commit comments

Comments
 (0)