Skip to content

Commit 0dfb169

Browse files
authored
Merging pull request #18601
* new components * pnpm-lock.yaml * version
1 parent 0a099c3 commit 0dfb169

File tree

5 files changed

+179
-10
lines changed

5 files changed

+179
-10
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import dataforseo from "../../dataforseo.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "dataforseo-create-onpage-task",
6+
name: "Create OnPage Task",
7+
description: "Create an OnPage task to retrieve detailed information on how well your pages are optimized for search. [See the documentation](https://docs.dataforseo.com/v3/on_page/task_post/)",
8+
version: "0.0.1",
9+
type: "action",
10+
annotations: {
11+
destructiveHint: false,
12+
openWorldHint: true,
13+
readOnlyHint: false,
14+
},
15+
props: {
16+
dataforseo,
17+
target: {
18+
propDefinition: [
19+
dataforseo,
20+
"target",
21+
],
22+
},
23+
maxCrawlPages: {
24+
type: "integer",
25+
label: "Max Crawl Pages",
26+
description: "The number of pages to crawl on the specified domain",
27+
},
28+
startUrl: {
29+
type: "string",
30+
label: "Start URL",
31+
description: "The URL to start crawling from",
32+
optional: true,
33+
},
34+
loadResources: {
35+
type: "boolean",
36+
label: "Load Resources",
37+
description: "Set to `true` if you want to load image, stylesheets, scripts, and broken resources on the page",
38+
optional: true,
39+
},
40+
enableJavascript: {
41+
type: "boolean",
42+
label: "Enable Javascript",
43+
description: "Set to `true` if you want to load the scripts available on a page",
44+
optional: true,
45+
},
46+
tag: {
47+
propDefinition: [
48+
dataforseo,
49+
"tag",
50+
],
51+
},
52+
pingbackUrl: {
53+
type: "string",
54+
label: "Pingback URL",
55+
description: "When a task is completed you will be notified by a GET request sent to the URL you have specified",
56+
optional: true,
57+
},
58+
},
59+
methods: {
60+
createOnpageTask(args = {}) {
61+
return this.dataforseo._makeRequest({
62+
path: "/on_page/task_post",
63+
method: "post",
64+
...args,
65+
});
66+
},
67+
},
68+
async run({ $ }) {
69+
const response = await this.createOnpageTask({
70+
$,
71+
data: [
72+
{
73+
target: this.target,
74+
max_crawl_pages: this.maxCrawlPages,
75+
start_url: this.startUrl,
76+
load_resources: this.loadResources,
77+
enable_javascript: this.enableJavascript,
78+
tag: this.tag,
79+
pingback_url: this.pingbackUrl,
80+
},
81+
],
82+
});
83+
84+
if (response.status_code !== 20000) {
85+
throw new ConfigurationError(`Error: ${response.status_message}`);
86+
}
87+
88+
if (response.tasks[0].status_code !== 20000 && response.tasks[0].status_code !== 20100) {
89+
throw new ConfigurationError(`Error: ${response.tasks[0].status_message}`);
90+
}
91+
92+
$.export("$summary", "Successfully created onpage task.");
93+
return response;
94+
},
95+
};
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import dataforseo from "../../dataforseo.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "dataforseo-get-crawled-pages",
6+
name: "Get Crawled Pages with OnPage",
7+
description: "Get page-specific data with detailed information on how well your pages are optimized for search. [See the documentation](https://docs.dataforseo.com/v3/on_page/pages/)",
8+
version: "0.0.1",
9+
type: "action",
10+
annotations: {
11+
destructiveHint: false,
12+
openWorldHint: true,
13+
readOnlyHint: true,
14+
},
15+
props: {
16+
dataforseo,
17+
taskId: {
18+
type: "string",
19+
label: "Task ID",
20+
description: "The ID of the task. You can get this ID in the response of the Task POST endpoint. Example: `07131248-1535-0216-1000-17384017ad04`",
21+
},
22+
limit: {
23+
propDefinition: [
24+
dataforseo,
25+
"limit",
26+
],
27+
},
28+
searchAfterToken: {
29+
type: "string",
30+
label: "Search After Token",
31+
description: "The token for subsequent requests",
32+
optional: true,
33+
},
34+
tag: {
35+
propDefinition: [
36+
dataforseo,
37+
"tag",
38+
],
39+
},
40+
},
41+
methods: {
42+
getCrawledPage(args = {}) {
43+
return this.dataforseo._makeRequest({
44+
path: "/on_page/pages",
45+
method: "post",
46+
...args,
47+
});
48+
},
49+
},
50+
async run({ $ }) {
51+
const response = await this.getCrawledPage({
52+
$,
53+
data: [
54+
{
55+
id: this.taskId,
56+
limit: this.limit,
57+
search_after_token: this.searchAfterToken,
58+
tag: this.tag,
59+
},
60+
],
61+
});
62+
63+
if (response.status_code !== 20000) {
64+
throw new ConfigurationError(`Error: ${response.status_message}`);
65+
}
66+
67+
if (response.tasks[0].status_code !== 20000) {
68+
throw new ConfigurationError(`Error: ${response.tasks[0].status_message}`);
69+
}
70+
71+
$.export("$summary", "Successfully retrieved crawled pages.");
72+
return response;
73+
},
74+
};

components/dataforseo/actions/parse-page-content/parse-page-content.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import dataforseo from "../../dataforseo.app.mjs";
33

44
export default {
55
key: "dataforseo-parse-page-content",
6-
name: "Parse Page Content",
6+
name: "Parse Page Content with OnPage",
77
description:
88
"Parse the content on any page and return its structured content. [See the documentation](https://docs.dataforseo.com/v3/on_page/content_parsing/live/)",
9-
version: "0.0.3",
9+
version: "0.0.4",
1010
annotations: {
1111
destructiveHint: false,
1212
openWorldHint: true,

components/dataforseo/package.json

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

pnpm-lock.yaml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)