Skip to content

Commit 991e3b8

Browse files
committed
Action adjustments
1 parent 3adb077 commit 991e3b8

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

components/spider/actions/scrape-new-page/scrape-new-page.mjs

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,44 @@ import spider from "../../spider.app.mjs";
33
export default {
44
key: "spider-scrape-new-page",
55
name: "Scrape New Page",
6-
description: "Initiates a new page scrape. [See the documentation](https://spider.cloud/docs/api)",
6+
description: "Initiates a new page scrape (crawl). [See the documentation](https://spider.cloud/docs/api#crawl-website)",
77
version: "0.0.{{ts}}",
88
type: "action",
99
props: {
1010
spider,
11+
infoBox: {
12+
type: "alert",
13+
alertType: "info",
14+
content: "See [the Spider documentation](https://spider.cloud/docs/api#crawl-website) for information on limits and best practices.",
15+
},
1116
url: {
12-
propDefinition: [
13-
spider,
14-
"url",
15-
],
17+
type: "string",
18+
label: "URL",
19+
description: "The URI resource to crawl, e.g. `https://spider.cloud`. This can be a comma split list for multiple urls.",
20+
},
21+
limit: {
22+
type: "integer",
23+
label: "Limit",
24+
description: "The maximum amount of pages allowed to crawl per website. Default is 0, which crawls all pages.",
25+
optional: true,
26+
},
27+
storeData: {
28+
type: "boolean",
29+
label: "Store Data",
30+
description: "Decide whether to store data. Default is `false`.",
31+
optional: true,
1632
},
1733
},
1834
async run({ $ }) {
19-
const content = await this.spider.initiateCrawl();
20-
$.export("$summary", `Successfully scraped content from ${this.url}`);
35+
const content = await this.spider.initiateCrawl({
36+
$,
37+
data: {
38+
url: this.url,
39+
limit: this.limit,
40+
store_data: this.storeData,
41+
},
42+
});
43+
$.export("$summary", `Successfully scraped URL ${this.url}`);
2144
return content;
2245
},
2346
};

0 commit comments

Comments
 (0)