Skip to content

Commit f8de313

Browse files
committed
fix(scrapeless):
- fix lint code error - fix Component check error
1 parent c7161f2 commit f8de313

File tree

10 files changed

+338
-293
lines changed

10 files changed

+338
-293
lines changed

components/scrapeless/actions/crawler/crawler.mjs

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,52 @@ export default {
1111
apiServer: {
1212
type: "string",
1313
label: "Please select a API server",
14-
default: 'crawl',
14+
description: "Please select a API server to use",
15+
default: "crawl",
1516
options: [
1617
{
1718
label: "Crawl",
18-
value: 'crawl'
19+
value: "crawl",
1920
},
2021
{
2122
label: "Scrape",
22-
value: 'scrape'
23-
}
23+
value: "scrape",
24+
},
2425
],
2526
reloadProps: true,
2627
},
2728
},
2829
async run({ $ }) {
29-
const { apiServer, ...rest } = this;
30+
const {
31+
scrapeless, apiServer, ...inputProps
32+
} = this;
3033

31-
if (apiServer === 'crawl') {
34+
if (apiServer === "crawl") {
3235
const submitData = {
33-
limit: rest.limitCrawlPages,
34-
url: rest.url,
35-
}
36-
const response = await this.scrapeless.crawlerCrawl({
36+
limit: inputProps.limitCrawlPages,
37+
url: inputProps.url,
38+
};
39+
const response = await scrapeless.crawlerCrawl({
3740
$,
3841
submitData,
39-
...rest,
42+
...inputProps,
4043
});
4144

42-
$.export("$summary", `Successfully retrieved crawling results for ${rest.url}`);
45+
$.export("$summary", `Successfully retrieved crawling results for ${inputProps.url}`);
4346
return response;
4447
}
4548

46-
if (apiServer === 'scrape') {
49+
if (apiServer === "scrape") {
4750
const submitData = {
48-
url: rest.url,
49-
}
50-
const response = await this.scrapeless.crawlerScrape({
51+
url: inputProps.url,
52+
};
53+
const response = await scrapeless.crawlerScrape({
5154
$,
5255
submitData,
53-
...rest,
56+
...inputProps,
5457
});
5558

56-
$.export("$summary", `Successfully retrieved scraping results for ${rest.url}`);
59+
$.export("$summary", `Successfully retrieved scraping results for ${inputProps.url}`);
5760
return response;
5861
}
5962
},
@@ -62,23 +65,23 @@ export default {
6265

6366
const props = {};
6467

65-
if (apiServer === 'crawl' || apiServer === 'scrape') {
68+
if (apiServer === "crawl" || apiServer === "scrape") {
6669
props.url = {
6770
type: "string",
6871
label: "URL to Crawl",
6972
description: "If you want to crawl in batches, please refer to the SDK of the document",
70-
}
73+
};
7174
}
7275

73-
if (apiServer === 'crawl') {
76+
if (apiServer === "crawl") {
7477
props.limitCrawlPages = {
7578
type: "integer",
7679
label: "Number Of Subpages",
7780
default: 5,
7881
description: "Max number of results to return",
79-
}
82+
};
8083
}
8184

8285
return props;
83-
}
84-
}
86+
},
87+
};

components/scrapeless/actions/get-scrape-result/get-scrape-result.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "scrapeless-get-scrape-result",
55
name: "Get Scrape Result",
66
description: "Retrieve the result of a completed scraping job. [See the documentation](https://apidocs.scrapeless.com/api-11949853)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
scrapeless,

components/scrapeless/actions/scraping-api/scraping-api.mjs

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,38 @@ export default {
1111
apiServer: {
1212
type: "string",
1313
label: "Please select a API server",
14-
default: 'googleSearch',
14+
default: "googleSearch",
15+
description: "Please select a API server to use",
1516
options: [
1617
{
1718
label: "Google Search",
18-
value: 'googleSearch'
19-
}
19+
value: "googleSearch",
20+
},
2021
],
2122
reloadProps: true,
2223
},
2324
},
2425
async run({ $ }) {
25-
const { apiServer, ...rest } = this;
26+
const {
27+
scrapeless, apiServer, ...inputProps
28+
} = this;
2629

27-
if (apiServer === 'googleSearch') {
30+
if (apiServer === "googleSearch") {
2831
const submitData = {
29-
actor: 'scraper.google.search',
32+
actor: "scraper.google.search",
3033
input: {
31-
q: rest.q,
32-
hl: rest.hl,
33-
gl: rest.gl,
34-
}
35-
}
36-
const response = await this.scrapeless.scrapingApi({
34+
q: inputProps.q,
35+
hl: inputProps.hl,
36+
gl: inputProps.gl,
37+
},
38+
};
39+
const response = await scrapeless.scrapingApi({
3740
$,
3841
submitData,
39-
...rest,
42+
...inputProps,
4043
});
4144

42-
$.export("$summary", `Successfully retrieved scraping results for Google Search`);
45+
$.export("$summary", "Successfully retrieved scraping results for Google Search");
4346
return response;
4447
}
4548
},
@@ -48,29 +51,29 @@ export default {
4851

4952
const props = {};
5053

51-
if (apiServer === 'googleSearch') {
54+
if (apiServer === "googleSearch") {
5255
props.q = {
5356
type: "string",
5457
label: "Search Query",
5558
description: "Parameter defines the query you want to search. You can use anything that you would use in a regular Google search. e.g. inurl:, site:, intitle:. We also support advanced search query parameters such as as_dt and as_eq.",
56-
default: "coffee"
57-
}
59+
default: "coffee",
60+
};
5861

5962
props.hl = {
6063
type: "string",
6164
label: "Language",
6265
description: "Parameter defines the language to use for the Google search. It's a two-letter language code. (e.g., en for English, es for Spanish, or fr for French).",
63-
default: "en"
64-
}
66+
default: "en",
67+
};
6568

6669
props.gl = {
6770
type: "string",
6871
label: "Country",
6972
description: "Parameter defines the country to use for the Google search. It's a two-letter country code. (e.g., us for the United States, uk for United Kingdom, or fr for France).",
70-
default: "us"
71-
}
73+
default: "us",
74+
};
7275
}
7376

7477
return props;
75-
}
76-
}
78+
},
79+
};

components/scrapeless/actions/submit-scrape-job/submit-scrape-job.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "scrapeless-submit-scrape-job",
88
name: "Submit Scrape Job",
99
description: "Submit a new web scraping job with specified target URL and extraction rules. [See the documentation](https://apidocs.scrapeless.com/api-11949852)",
10-
version: "0.0.1",
10+
version: "0.0.2",
1111
type: "action",
1212
props: {
1313
scrapeless,

components/scrapeless/actions/universal-scraping-api/universal-scraping-api.mjs

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,41 @@ export default {
1212
apiServer: {
1313
type: "string",
1414
label: "Please select a API server",
15-
default: 'webUnlocker',
15+
default: "webUnlocker",
16+
description: "Please select a API server to use",
1617
options: [
1718
{
1819
label: "Web Unlocker",
19-
value: 'webUnlocker'
20-
}
20+
value: "webUnlocker",
21+
},
2122
],
2223
reloadProps: true,
2324
},
2425
},
2526
async run({ $ }) {
26-
const { apiServer, ...rest } = this;
27+
const {
28+
apiServer, ...rest
29+
} = this;
2730

28-
if (apiServer === 'webUnlocker') {
31+
if (apiServer === "webUnlocker") {
2932
const submitData = {
30-
actor: 'unlocker.webunlocker',
33+
actor: "unlocker.webunlocker",
3134
input: {
3235
url: rest.url,
3336
jsRender: rest.jsRender,
3437
headless: rest.headless,
3538
},
3639
proxy: {
3740
country: rest.country,
38-
}
39-
}
41+
},
42+
};
4043
const response = await this.scrapeless.universalScrapingApi({
4144
$,
4245
submitData,
4346
...rest,
4447
});
4548

46-
$.export("$summary", `Successfully retrieved scraping results for Web Unlocker`);
49+
$.export("$summary", "Successfully retrieved scraping results for Web Unlocker");
4750
return response;
4851
}
4952
},
@@ -52,24 +55,24 @@ export default {
5255

5356
const props = {};
5457

55-
if (apiServer === 'webUnlocker') {
58+
if (apiServer === "webUnlocker") {
5659
props.url = {
5760
type: "string",
5861
label: "Target URL",
5962
description: "Parameter defines the URL you want to scrape.",
60-
}
63+
};
6164

6265
props.jsRender = {
6366
type: "boolean",
6467
label: "Js Render",
6568
default: true,
66-
}
69+
};
6770

6871
props.headless = {
6972
type: "boolean",
7073
label: "Headless",
7174
default: true,
72-
}
75+
};
7376

7477
props.country = {
7578
type: "string",
@@ -78,10 +81,10 @@ export default {
7881
options: countryOptions.map((country) => ({
7982
label: country.label,
8083
value: country.value,
81-
}))
82-
}
84+
})),
85+
};
8386
}
8487

8588
return props;
86-
}
87-
}
89+
},
90+
};

0 commit comments

Comments
 (0)