@activepieces/piece-scrapeless 0.0.1
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.
- package/README.md +7 -0
- package/package.json +39 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +79 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/crawl-crawl.d.ts +4 -0
- package/src/lib/actions/crawl-crawl.js +69 -0
- package/src/lib/actions/crawl-crawl.js.map +1 -0
- package/src/lib/actions/crawl-scrape.d.ts +3 -0
- package/src/lib/actions/crawl-scrape.js +61 -0
- package/src/lib/actions/crawl-scrape.js.map +1 -0
- package/src/lib/actions/google-search-api.d.ts +5 -0
- package/src/lib/actions/google-search-api.js +75 -0
- package/src/lib/actions/google-search-api.js.map +1 -0
- package/src/lib/actions/google-trends-api.d.ts +7 -0
- package/src/lib/actions/google-trends-api.js +93 -0
- package/src/lib/actions/google-trends-api.js.map +1 -0
- package/src/lib/actions/universal-scraping-api.d.ts +8 -0
- package/src/lib/actions/universal-scraping-api.js +82 -0
- package/src/lib/actions/universal-scraping-api.js.map +1 -0
- package/src/lib/constants/index.d.ts +8 -0
- package/src/lib/constants/index.js +672 -0
- package/src/lib/constants/index.js.map +1 -0
- package/src/lib/services/scrapeless-api-client.d.ts +2 -0
- package/src/lib/services/scrapeless-api-client.js +11 -0
- package/src/lib/services/scrapeless-api-client.js.map +1 -0
- package/src/lib/utils/validator.d.ts +4 -0
- package/src/lib/utils/validator.js +34 -0
- package/src/lib/utils/validator.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-scrapeless",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@ai-sdk/anthropic": "1.2.12",
|
|
9
|
+
"@ai-sdk/google": "1.2.19",
|
|
10
|
+
"@ai-sdk/openai": "1.3.22",
|
|
11
|
+
"@ai-sdk/replicate": "0.2.8",
|
|
12
|
+
"@scrapeless-ai/sdk": "1.5.1",
|
|
13
|
+
"@sinclair/typebox": "0.34.11",
|
|
14
|
+
"ai": "4.3.16",
|
|
15
|
+
"axios": "1.8.3",
|
|
16
|
+
"axios-retry": "4.4.1",
|
|
17
|
+
"deepmerge-ts": "7.1.0",
|
|
18
|
+
"fast-glob": "3.3.3",
|
|
19
|
+
"mime-types": "2.1.35",
|
|
20
|
+
"nanoid": "3.3.8",
|
|
21
|
+
"semver": "7.6.0",
|
|
22
|
+
"zod": "3.25.67",
|
|
23
|
+
"@activepieces/pieces-common": "0.6.0",
|
|
24
|
+
"@activepieces/pieces-framework": "0.15.0",
|
|
25
|
+
"@activepieces/shared": "0.16.0",
|
|
26
|
+
"tslib": "2.8.1"
|
|
27
|
+
},
|
|
28
|
+
"overrides": {
|
|
29
|
+
"@tryfabric/martian": {
|
|
30
|
+
"@notionhq/client": "$@notionhq/client"
|
|
31
|
+
},
|
|
32
|
+
"vite": {
|
|
33
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"resolutions": {
|
|
37
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scrapeless = exports.scrapelessApiAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const validator_1 = require("./lib/utils/validator");
|
|
7
|
+
const google_search_api_1 = require("./lib/actions/google-search-api");
|
|
8
|
+
const crawl_scrape_1 = require("./lib/actions/crawl-scrape");
|
|
9
|
+
const crawl_crawl_1 = require("./lib/actions/crawl-crawl");
|
|
10
|
+
const google_trends_api_1 = require("./lib/actions/google-trends-api");
|
|
11
|
+
const universal_scraping_api_1 = require("./lib/actions/universal-scraping-api");
|
|
12
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
13
|
+
const shared_1 = require("@activepieces/shared");
|
|
14
|
+
exports.scrapelessApiAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
15
|
+
displayName: 'API Key',
|
|
16
|
+
description: `You can obtain your API key from [Dashboard](https://app.scrapeless.com).`,
|
|
17
|
+
required: true,
|
|
18
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
19
|
+
try {
|
|
20
|
+
// Validate API key format first
|
|
21
|
+
const formatValidation = yield validator_1.ScrapelessValidator.validateApiKey(auth);
|
|
22
|
+
if (!formatValidation.isValid) {
|
|
23
|
+
return {
|
|
24
|
+
valid: false,
|
|
25
|
+
error: `${formatValidation.errors.join(', ')}`,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
valid: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
34
|
+
if (errorMessage.includes('timeout')) {
|
|
35
|
+
return {
|
|
36
|
+
valid: false,
|
|
37
|
+
error: 'API validation timed out. Please check your network connection and try again.',
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (errorMessage.includes('network') || errorMessage.includes('ENOTFOUND')) {
|
|
41
|
+
return {
|
|
42
|
+
valid: false,
|
|
43
|
+
error: 'Network error occurred. Please check your internet connection.',
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
valid: false,
|
|
48
|
+
error: `API key validation failed: ${errorMessage}`,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
exports.scrapeless = (0, pieces_framework_1.createPiece)({
|
|
54
|
+
displayName: 'Scrapeless',
|
|
55
|
+
description: 'Scrapeless is an all-in-one and highly scalable web scraping toolkit for enterprises and developers.',
|
|
56
|
+
auth: exports.scrapelessApiAuth,
|
|
57
|
+
minimumSupportedRelease: '0.36.1',
|
|
58
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/scrapeless.png',
|
|
59
|
+
categories: [shared_1.PieceCategory.PRODUCTIVITY],
|
|
60
|
+
authors: ['sunorains'],
|
|
61
|
+
actions: [
|
|
62
|
+
google_search_api_1.googleSearchApi,
|
|
63
|
+
crawl_scrape_1.crawlScrapeApi,
|
|
64
|
+
crawl_crawl_1.crawlCrawlApi,
|
|
65
|
+
google_trends_api_1.googleTrendsApi,
|
|
66
|
+
universal_scraping_api_1.universalScrapingApi,
|
|
67
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
68
|
+
auth: exports.scrapelessApiAuth,
|
|
69
|
+
baseUrl: () => 'https://api.scrapeless.com/api/v1',
|
|
70
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
+
return {
|
|
72
|
+
'x-api-token': auth
|
|
73
|
+
};
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
],
|
|
77
|
+
triggers: [],
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/scrapeless/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,qDAA4D;AAC5D,uEAAkE;AAClE,6DAA4D;AAC5D,2DAA0D;AAC1D,uEAAkE;AAClE,iFAA4E;AAC5E,+DAAwE;AACxE,iDAAqD;AAExC,QAAA,iBAAiB,GAAG,4BAAS,CAAC,UAAU,CAAC;IACpD,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,2EAA2E;IACxF,QA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IAC7D,UAAU,EAAC,CAAC,sBAAa,CAAC,YAAY,CAAC;IACvC,OAAO,EAAE,CAAC,WAAW,CAAC;IACtB,OAAO,EAAE;QACP,mCAAe;QACf,6BAAc;QACd,2BAAa;QACb,mCAAe;QACf,6CAAoB;QACpB,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAC,yBAAiB;YACtB,OAAO,EAAC,GAAE,EAAE,CAAA,mCAAmC;YAC/C,WAAW,EAAC,CAAM,IAAI,EAAC,EAAE;gBACvB,OAAM;oBACJ,aAAa,EAAC,IAAc;iBAC7B,CAAA;YACH,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const crawlCrawlApi: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.crawlCrawlApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const index_1 = require("../../index");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const scrapeless_api_client_1 = require("../services/scrapeless-api-client");
|
|
8
|
+
exports.crawlCrawlApi = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: index_1.scrapelessApiAuth,
|
|
10
|
+
name: 'crawl_crawl',
|
|
11
|
+
displayName: 'Crawl Data from All Pages',
|
|
12
|
+
description: 'Crawls a website and its linked pages to extract comprehensive data.',
|
|
13
|
+
props: {
|
|
14
|
+
url: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'URL to Crawl',
|
|
16
|
+
description: 'The URL of the webpage to crawl.',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
limit: pieces_framework_1.Property.Number({
|
|
20
|
+
displayName: 'Limit',
|
|
21
|
+
description: 'Number Of Subpages',
|
|
22
|
+
required: true,
|
|
23
|
+
defaultValue: 5,
|
|
24
|
+
})
|
|
25
|
+
},
|
|
26
|
+
run(_a) {
|
|
27
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
|
|
28
|
+
try {
|
|
29
|
+
const client = (0, scrapeless_api_client_1.createScrapelessClient)(auth);
|
|
30
|
+
const url = propsValue.url;
|
|
31
|
+
const limit = propsValue.limit;
|
|
32
|
+
const browserOptions = {
|
|
33
|
+
"proxy_country": "ANY",
|
|
34
|
+
"session_name": "Crawl",
|
|
35
|
+
"session_recording": true,
|
|
36
|
+
"session_ttl": 900,
|
|
37
|
+
};
|
|
38
|
+
const response = yield client.scrapingCrawl.crawl.crawlUrl(url, {
|
|
39
|
+
browserOptions,
|
|
40
|
+
limit
|
|
41
|
+
});
|
|
42
|
+
if (response.status === 'completed' && response.data) {
|
|
43
|
+
return {
|
|
44
|
+
success: true,
|
|
45
|
+
data: response.data || null,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return {
|
|
50
|
+
success: false,
|
|
51
|
+
error: 'Scraping failed',
|
|
52
|
+
error_type: 'ScrapingFailed',
|
|
53
|
+
timestamp: new Date().toISOString(),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
59
|
+
return {
|
|
60
|
+
success: false,
|
|
61
|
+
error: errorMessage,
|
|
62
|
+
error_type: error instanceof Error ? error.constructor.name : 'UnknownError',
|
|
63
|
+
timestamp: new Date().toISOString(),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=crawl-crawl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crawl-crawl.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/scrapeless/src/lib/actions/crawl-crawl.ts"],"names":[],"mappings":";;;;AAAA,uCAAgD;AAChD,qEAAwE;AACxE,6EAA2E;AAE9D,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,yBAAiB;IACvB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,sEAAsE;IACnF,KAAK,EAAE;QACL,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,CAAC;SAChB,CAAC;KAEH;IACK,GAAG;qEAAC,EAAE,UAAU,EAAE,IAAI,EAAE;YAC5B,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAA,8CAAsB,EAAC,IAAI,CAAC,CAAC;gBAE5C,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;gBAC3B,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;gBAC/B,MAAM,cAAc,GAAG;oBACrB,eAAe,EAAE,KAAK;oBACtB,cAAc,EAAE,OAAO;oBACvB,mBAAmB,EAAE,IAAI;oBACzB,aAAa,EAAE,GAAG;iBACnB,CAAA;gBAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE;oBAC9D,cAAc;oBACd,KAAK;iBACN,CAAC,CAAA;gBAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,WAAW,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;oBACrD,OAAO;wBACL,OAAO,EAAE,IAAI;wBACb,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,IAAI;qBAC5B,CAAA;gBACH,CAAC;qBAAM,CAAC;oBACN,OAAO;wBACL,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,iBAAiB;wBACxB,UAAU,EAAE,gBAAgB;wBAC5B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;qBACpC,CAAA;gBACH,CAAC;YAEH,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACxB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;gBAEvF,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,YAAY;oBACnB,UAAU,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;oBAC5E,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBACpC,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.crawlScrapeApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const index_1 = require("../../index");
|
|
7
|
+
const scrapeless_api_client_1 = require("../services/scrapeless-api-client");
|
|
8
|
+
exports.crawlScrapeApi = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: index_1.scrapelessApiAuth,
|
|
10
|
+
name: 'crawl_scrape',
|
|
11
|
+
displayName: 'Scrape Webpage Data',
|
|
12
|
+
description: 'Extracts data from a single webpage.',
|
|
13
|
+
props: {
|
|
14
|
+
url: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'URL to Crawl',
|
|
16
|
+
description: 'The URL of the webpage to scrape.',
|
|
17
|
+
required: true,
|
|
18
|
+
})
|
|
19
|
+
},
|
|
20
|
+
run(_a) {
|
|
21
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
|
|
22
|
+
try {
|
|
23
|
+
const client = (0, scrapeless_api_client_1.createScrapelessClient)(auth);
|
|
24
|
+
const url = propsValue.url;
|
|
25
|
+
const browserOptions = {
|
|
26
|
+
"proxy_country": "ANY",
|
|
27
|
+
"session_name": "Crawl",
|
|
28
|
+
"session_recording": true,
|
|
29
|
+
"session_ttl": 900,
|
|
30
|
+
};
|
|
31
|
+
const response = yield client.scrapingCrawl.scrape.scrapeUrl(url, {
|
|
32
|
+
browserOptions
|
|
33
|
+
});
|
|
34
|
+
if (response.status === 'completed' && response.data) {
|
|
35
|
+
return {
|
|
36
|
+
success: true,
|
|
37
|
+
data: response.data || null,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return {
|
|
42
|
+
success: false,
|
|
43
|
+
error: 'Scraping failed',
|
|
44
|
+
error_type: 'ScrapingFailed',
|
|
45
|
+
timestamp: new Date().toISOString(),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
51
|
+
return {
|
|
52
|
+
success: false,
|
|
53
|
+
error: errorMessage,
|
|
54
|
+
error_type: error instanceof Error ? error.constructor.name : 'UnknownError',
|
|
55
|
+
timestamp: new Date().toISOString(),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=crawl-scrape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crawl-scrape.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/scrapeless/src/lib/actions/crawl-scrape.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,uCAAgD;AAChD,6EAA2E;AAE9D,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,yBAAiB;IACvB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,sCAAsC;IAGnD,KAAK,EAAE;QACL,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,UAAU,EAAE,IAAI,EAAE;YAC5B,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAA,8CAAsB,EAAC,IAAI,CAAC,CAAC;gBAE5C,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;gBAC3B,MAAM,cAAc,GAAG;oBACrB,eAAe,EAAE,KAAK;oBACtB,cAAc,EAAE,OAAO;oBACvB,mBAAmB,EAAE,IAAI;oBACzB,aAAa,EAAE,GAAG;iBACnB,CAAA;gBAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE;oBAChE,cAAc;iBACf,CAAC,CAAA;gBAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,WAAW,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;oBACrD,OAAO;wBACL,OAAO,EAAE,IAAI;wBACb,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,IAAI;qBAC5B,CAAA;gBACH,CAAC;qBAAM,CAAC;oBACN,OAAO;wBACL,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,iBAAiB;wBACxB,UAAU,EAAE,gBAAgB;wBAC5B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;qBACpC,CAAA;gBACH,CAAC;YAEH,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACxB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;gBAEvF,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,YAAY;oBACnB,UAAU,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;oBAC5E,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBACpC,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const googleSearchApi: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
q: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
hl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
gl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.googleSearchApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const index_1 = require("../../index");
|
|
7
|
+
const scrapeless_api_client_1 = require("../services/scrapeless-api-client");
|
|
8
|
+
exports.googleSearchApi = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: index_1.scrapelessApiAuth,
|
|
10
|
+
name: 'google_search_api',
|
|
11
|
+
displayName: 'Google Search',
|
|
12
|
+
description: 'Retrieves search result data for any query.',
|
|
13
|
+
props: {
|
|
14
|
+
q: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Search Query',
|
|
16
|
+
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.',
|
|
17
|
+
defaultValue: 'coffee',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
hl: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Language',
|
|
22
|
+
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).",
|
|
23
|
+
defaultValue: 'en',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
gl: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'Country',
|
|
28
|
+
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).",
|
|
29
|
+
defaultValue: 'us',
|
|
30
|
+
required: false,
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
run(_a) {
|
|
34
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
|
|
35
|
+
try {
|
|
36
|
+
const client = (0, scrapeless_api_client_1.createScrapelessClient)(auth);
|
|
37
|
+
const input = {
|
|
38
|
+
q: propsValue.q,
|
|
39
|
+
hl: propsValue.hl,
|
|
40
|
+
gl: propsValue.gl,
|
|
41
|
+
};
|
|
42
|
+
const response = yield client.deepserp.createTask({
|
|
43
|
+
actor: 'scraper.google.search',
|
|
44
|
+
input,
|
|
45
|
+
});
|
|
46
|
+
if (response.status === 200) {
|
|
47
|
+
return {
|
|
48
|
+
success: true,
|
|
49
|
+
data: response.data || null,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
while (true) {
|
|
53
|
+
yield new Promise(resolve => setTimeout(resolve, 1000));
|
|
54
|
+
const result = yield client.deepserp.getTaskResult(response.data.taskId);
|
|
55
|
+
if (result.status === 200) {
|
|
56
|
+
return {
|
|
57
|
+
success: true,
|
|
58
|
+
data: result.data || null,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
65
|
+
return {
|
|
66
|
+
success: false,
|
|
67
|
+
error: errorMessage,
|
|
68
|
+
error_type: error instanceof Error ? error.constructor.name : 'UnknownError',
|
|
69
|
+
timestamp: new Date().toISOString(),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=google-search-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-search-api.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/scrapeless/src/lib/actions/google-search-api.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,uCAAgD;AAChD,6EAA2E;AAE9D,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,yBAAiB;IACvB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,6CAA6C;IAE1D,KAAK,EAAE;QACL,CAAC,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACpB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,6NAA6N;YAC1O,YAAY,EAAE,QAAQ;YACtB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,EAAE,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,yJAAyJ;YACtK,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,EAAE,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,wKAAwK;YACrL,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IAEK,GA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E,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;oBAC5E,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBACpC,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const googleTrendsApi: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
q: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
data_type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
date: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
hl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
tz: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.googleTrendsApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const index_1 = require("../../index");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
const scrapeless_api_client_1 = require("../services/scrapeless-api-client");
|
|
9
|
+
exports.googleTrendsApi = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.scrapelessApiAuth,
|
|
11
|
+
name: 'google_trends_api',
|
|
12
|
+
displayName: 'Google Trends',
|
|
13
|
+
description: 'Access popular keyword and interest data from Google Trends.',
|
|
14
|
+
props: {
|
|
15
|
+
q: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Search Query',
|
|
17
|
+
description: 'Parameter defines the query or queries you want to search. You can use anything that you would use in a regular Google Trends search. The maximum number of queries per search is 5 (this only applies to `interest_over_time` and `compared_breakdown_by_region` data_type, other types of data will only accept 1 query per search).',
|
|
18
|
+
defaultValue: 'Mercedes-Benz,BMW X5',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
data_type: pieces_framework_1.Property.StaticDropdown({
|
|
22
|
+
displayName: 'Data Type',
|
|
23
|
+
description: 'Parameter defines the type of data you want to search. You can use anything that you would use in a regular Google Trends search. The maximum number of queries per search is 5 (this only applies to `interest_over_time` and `compared_breakdown_by_region` data_type, other types of data will only accept 1 query per search).',
|
|
24
|
+
required: true,
|
|
25
|
+
defaultValue: 'interest_over_time',
|
|
26
|
+
options: {
|
|
27
|
+
options: constants_1.googleTrendsDataTypeOptions,
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
date: pieces_framework_1.Property.ShortText({
|
|
31
|
+
displayName: 'Date',
|
|
32
|
+
description: "The supported dates are: `now 1-H`, `now 4-H`, `now 1-d`, `now 7-d`, `today 1-m`, `today 3-m`, `today 12-m`, `today 5-y`, `all`.You can also pass custom values:Dates from 2004 to present: `yyyy-mm-dd yyyy-mm-dd` (e.g. `2021-10-15 2022-05-25`)\nDates with hours within a week range: `yyyy-mm-ddThh yyyy-mm-ddThh` (e.g. `2022-05-19T10 2022-05-24T22`). Hours will be calculated depending on the tz (time zone) parameter.",
|
|
33
|
+
required: true,
|
|
34
|
+
defaultValue: 'today 1-m',
|
|
35
|
+
}),
|
|
36
|
+
hl: pieces_framework_1.Property.ShortText({
|
|
37
|
+
displayName: 'Language',
|
|
38
|
+
description: "Parameter defines the language to use for the Google Trends search. It's a two-letter language code. (e.g., `en` for English, `es` for Spanish, or `fr` for French).",
|
|
39
|
+
required: false,
|
|
40
|
+
defaultValue: 'en',
|
|
41
|
+
}),
|
|
42
|
+
tz: pieces_framework_1.Property.ShortText({
|
|
43
|
+
displayName: 'Time zone',
|
|
44
|
+
description: "time zone offset. default is `420`.",
|
|
45
|
+
required: false,
|
|
46
|
+
defaultValue: '420',
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
run(_a) {
|
|
50
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
|
|
51
|
+
try {
|
|
52
|
+
const client = (0, scrapeless_api_client_1.createScrapelessClient)(auth);
|
|
53
|
+
const input = {
|
|
54
|
+
q: propsValue.q,
|
|
55
|
+
data_type: propsValue.data_type,
|
|
56
|
+
date: propsValue.date,
|
|
57
|
+
hl: propsValue.hl,
|
|
58
|
+
tz: propsValue.tz,
|
|
59
|
+
};
|
|
60
|
+
const response = yield client.deepserp.createTask({
|
|
61
|
+
actor: 'scraper.google.trends',
|
|
62
|
+
input,
|
|
63
|
+
});
|
|
64
|
+
if (response.status === 200) {
|
|
65
|
+
return {
|
|
66
|
+
success: true,
|
|
67
|
+
data: response.data || null,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
while (true) {
|
|
71
|
+
yield new Promise(resolve => setTimeout(resolve, 1000));
|
|
72
|
+
const result = yield client.deepserp.getTaskResult(response.data.taskId);
|
|
73
|
+
if (result.status === 200) {
|
|
74
|
+
return {
|
|
75
|
+
success: true,
|
|
76
|
+
data: result.data || null,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
83
|
+
return {
|
|
84
|
+
success: false,
|
|
85
|
+
error: errorMessage,
|
|
86
|
+
error_type: error instanceof Error ? error.constructor.name : 'UnknownError',
|
|
87
|
+
timestamp: new Date().toISOString(),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=google-trends-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-trends-api.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/scrapeless/src/lib/actions/google-trends-api.ts"],"names":[],"mappings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C,cAAc;oBAC5E,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBACpC,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const universalScrapingApi: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
js_render: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
4
|
+
headless: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
5
|
+
country: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
6
|
+
js_instructions: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
7
|
+
block: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.universalScrapingApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const index_1 = require("../../index");
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
const scrapeless_api_client_1 = require("../services/scrapeless-api-client");
|
|
9
|
+
exports.universalScrapingApi = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.scrapelessApiAuth,
|
|
11
|
+
name: 'universal_scraping_api',
|
|
12
|
+
displayName: 'Universal Scraping',
|
|
13
|
+
description: 'Seamlessly accesses protected or dynamic pages by handling anti-scraping systems automatically.',
|
|
14
|
+
props: {
|
|
15
|
+
url: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Target URL',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
js_render: pieces_framework_1.Property.Checkbox({
|
|
20
|
+
displayName: 'Js Render',
|
|
21
|
+
required: false,
|
|
22
|
+
defaultValue: true,
|
|
23
|
+
}),
|
|
24
|
+
headless: pieces_framework_1.Property.Checkbox({
|
|
25
|
+
displayName: 'Headless',
|
|
26
|
+
required: false,
|
|
27
|
+
defaultValue: true,
|
|
28
|
+
}),
|
|
29
|
+
country: pieces_framework_1.Property.StaticDropdown({
|
|
30
|
+
displayName: 'Country',
|
|
31
|
+
required: false,
|
|
32
|
+
defaultValue: 'ANY',
|
|
33
|
+
options: {
|
|
34
|
+
options: constants_1.proxyCountryOptions,
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
js_instructions: pieces_framework_1.Property.Json({
|
|
38
|
+
displayName: 'Js Instructions',
|
|
39
|
+
required: false,
|
|
40
|
+
defaultValue: [{ "wait": 1000 }],
|
|
41
|
+
}),
|
|
42
|
+
block: pieces_framework_1.Property.Json({
|
|
43
|
+
displayName: 'Block',
|
|
44
|
+
required: false,
|
|
45
|
+
defaultValue: { "resources": ["image", "font", "script"], "urls": ["https://example.com"] },
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
run(_a) {
|
|
49
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
|
|
50
|
+
try {
|
|
51
|
+
const client = (0, scrapeless_api_client_1.createScrapelessClient)(auth);
|
|
52
|
+
const input = {
|
|
53
|
+
url: propsValue.url,
|
|
54
|
+
js_render: propsValue.js_render,
|
|
55
|
+
headless: propsValue.headless,
|
|
56
|
+
js_instructions: propsValue.js_instructions,
|
|
57
|
+
block: propsValue.block,
|
|
58
|
+
};
|
|
59
|
+
const proxy = {
|
|
60
|
+
country: propsValue.country,
|
|
61
|
+
};
|
|
62
|
+
const response = yield client.universal.scrape({
|
|
63
|
+
actor: 'unlocker.webunlocker',
|
|
64
|
+
input,
|
|
65
|
+
proxy,
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
success: true,
|
|
69
|
+
data: response || null,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
74
|
+
return {
|
|
75
|
+
success: false,
|
|
76
|
+
error: errorMessage,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=universal-scraping-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"universal-scraping-api.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/scrapeless/src/lib/actions/universal-scraping-api.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,uCAAgD;AAChD,4CAAmD;AACnD,6EAA2E;AAE9D,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,yBAAiB;IACvB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,iGAAiG;IAC9G,KAAK,EAAE;QACL,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC/B,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;YACnB,OAAO,EAAE;gBACP,OAAO,EAAE,+BAAmB;aAC7B;SACF,CAAC;QACF,eAAe,EAAE,2BAAQ,CAAC,IAAI,CAAC;YAC7B,WAAW,EAAE,iBAA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