@taskmagic/apps-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 +3 -0
- package/package.json +47 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +56 -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 +63 -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 +57 -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 +58 -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 +76 -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/common/auth.d.ts +1 -0
- package/src/lib/common/auth.js +38 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +12 -0
- package/src/lib/common/client.js +121 -0
- package/src/lib/common/client.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/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@taskmagic/apps-scrapeless",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@anthropic-ai/sdk": "0.33.1",
|
|
6
|
+
"@sinclair/typebox": "0.34.11",
|
|
7
|
+
"axios": "1.17.0",
|
|
8
|
+
"axios-retry": "4.4.1",
|
|
9
|
+
"deepmerge-ts": "7.1.0",
|
|
10
|
+
"mime-types": "2.1.35",
|
|
11
|
+
"nanoid": "3.3.8",
|
|
12
|
+
"openai": "4.67.1",
|
|
13
|
+
"replicate": "0.34.1",
|
|
14
|
+
"semver": "7.6.0",
|
|
15
|
+
"zod": "3.25.76",
|
|
16
|
+
"@taskmagic/pieces-common": "0.4.4",
|
|
17
|
+
"@taskmagic/pieces-framework": "0.7.46",
|
|
18
|
+
"@taskmagic/shared": "0.10.171",
|
|
19
|
+
"tslib": "1.14.1"
|
|
20
|
+
},
|
|
21
|
+
"overrides": {
|
|
22
|
+
"cross-spawn": "7.0.6",
|
|
23
|
+
"elliptic": "^6.6.1",
|
|
24
|
+
"fast-xml-parser": "^4.4.1",
|
|
25
|
+
"protobufjs": "^7.5.5",
|
|
26
|
+
"tmp": "^0.2.4",
|
|
27
|
+
"koa": "^2.16.4",
|
|
28
|
+
"picomatch": "^4.0.4",
|
|
29
|
+
"langsmith": "^0.6.0",
|
|
30
|
+
"serialize-javascript": "^6.0.2",
|
|
31
|
+
"elevenlabs": {
|
|
32
|
+
"form-data": "^4.0.4"
|
|
33
|
+
},
|
|
34
|
+
"@tryfabric/martian": {
|
|
35
|
+
"@notionhq/client": "$@notionhq/client"
|
|
36
|
+
},
|
|
37
|
+
"vite": {
|
|
38
|
+
"rollup": "npm:@rollup/wasm-node@^4.61.1"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"resolutions": {
|
|
42
|
+
"rollup": "npm:@rollup/wasm-node@^4.61.1"
|
|
43
|
+
},
|
|
44
|
+
"types": "./src/index.d.ts",
|
|
45
|
+
"main": "./src/index.js",
|
|
46
|
+
"type": "commonjs"
|
|
47
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const scrapeless: import("@taskmagic/pieces-framework").Piece<import("@taskmagic/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scrapeless = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const shared_1 = require("@taskmagic/shared");
|
|
8
|
+
const auth_1 = require("./lib/common/auth");
|
|
9
|
+
const client_1 = require("./lib/common/client");
|
|
10
|
+
const google_search_api_1 = require("./lib/actions/google-search-api");
|
|
11
|
+
const crawl_scrape_1 = require("./lib/actions/crawl-scrape");
|
|
12
|
+
const crawl_crawl_1 = require("./lib/actions/crawl-crawl");
|
|
13
|
+
const google_trends_api_1 = require("./lib/actions/google-trends-api");
|
|
14
|
+
const universal_scraping_api_1 = require("./lib/actions/universal-scraping-api");
|
|
15
|
+
exports.scrapeless = (0, pieces_framework_1.createPiece)({
|
|
16
|
+
displayName: 'Scrapeless',
|
|
17
|
+
description: 'Scrapeless is an all-in-one and highly scalable web scraping toolkit for enterprises and developers.',
|
|
18
|
+
auth: auth_1.scrapelessApiAuth,
|
|
19
|
+
minimumSupportedRelease: '0.30.0',
|
|
20
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/scrapeless.png',
|
|
21
|
+
categories: [shared_1.PieceCategory.PRODUCTIVITY],
|
|
22
|
+
authors: ['sunorains'],
|
|
23
|
+
ai: {
|
|
24
|
+
description: 'Scrape the web with Scrapeless: run Google search and Google Trends queries, scrape a single webpage, crawl a whole site, and fetch protected or JavaScript-heavy pages through an anti-bot web unlocker.',
|
|
25
|
+
keywords: [
|
|
26
|
+
'scrape',
|
|
27
|
+
'web scraping',
|
|
28
|
+
'crawl',
|
|
29
|
+
'google search',
|
|
30
|
+
'google trends',
|
|
31
|
+
'serp',
|
|
32
|
+
'web unlocker',
|
|
33
|
+
'anti-bot',
|
|
34
|
+
'extract webpage data',
|
|
35
|
+
'proxy',
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
actions: [
|
|
39
|
+
google_search_api_1.googleSearchApi,
|
|
40
|
+
crawl_scrape_1.crawlScrapeApi,
|
|
41
|
+
crawl_crawl_1.crawlCrawlApi,
|
|
42
|
+
google_trends_api_1.googleTrendsApi,
|
|
43
|
+
universal_scraping_api_1.universalScrapingApi,
|
|
44
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
45
|
+
auth: auth_1.scrapelessApiAuth,
|
|
46
|
+
baseUrl: () => `${client_1.SCRAPELESS_BASE_URL}/api/v1`,
|
|
47
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
return {
|
|
49
|
+
'x-api-token': auth,
|
|
50
|
+
};
|
|
51
|
+
}),
|
|
52
|
+
}),
|
|
53
|
+
],
|
|
54
|
+
triggers: [],
|
|
55
|
+
});
|
|
56
|
+
//# 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,kEAA0D;AAC1D,4DAAqE;AACrE,8CAAkD;AAClD,4CAAsD;AACtD,gDAA0D;AAC1D,uEAAkE;AAClE,6DAA4D;AAC5D,2DAA0D;AAC1D,uEAAkE;AAClE,iFAA4E;AAE/D,QAAA,UAAU,GAAG,IAAA,8BAAW,EAAC;IACpC,WAAW,EAAE,YAAY;IACzB,WAAW,EACT,sGAAsG;IACxG,IAAI,EAAE,wBAAiB;IACvB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,oDAAoD;IAC7D,UAAU,EAAE,CAAC,sBAAa,CAAC,YAAY,CAAC;IACxC,OAAO,EAAE,CAAC,WAAW,CAAC;IACtB,EAAE,EAAE;QACF,WAAW,EACT,2MAA2M;QAC7M,QAAQ,EAAE;YACR,QAAQ;YACR,cAAc;YACd,OAAO;YACP,eAAe;YACf,eAAe;YACf,MAAM;YACN,cAAc;YACd,UAAU;YACV,sBAAsB;YACtB,OAAO;SACR;KACF;IACD,OAAO,EAAE;QACP,mCAAe;QACf,6BAAc;QACd,2BAAa;QACb,mCAAe;QACf,6CAAoB;QACpB,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,wBAAiB;YACvB,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,4BAAmB,SAAS;YAC9C,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,aAAa,EAAE,IAAc;iBAC9B,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const crawlCrawlApi: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
url: import("@taskmagic/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
limit: import("@taskmagic/pieces-framework").NumberProperty<true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.crawlCrawlApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
exports.crawlCrawlApi = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: auth_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 browserOptions = {
|
|
30
|
+
proxy_country: 'ANY',
|
|
31
|
+
session_name: 'Crawl',
|
|
32
|
+
session_recording: true,
|
|
33
|
+
session_ttl: 900,
|
|
34
|
+
};
|
|
35
|
+
const response = yield client_1.scrapelessCommon.crawlCrawlUrl(auth, propsValue.url, { browserOptions, limit: propsValue.limit });
|
|
36
|
+
if ((response === null || response === void 0 ? void 0 : response.status) === 'completed' && (response === null || response === void 0 ? void 0 : response.data)) {
|
|
37
|
+
return {
|
|
38
|
+
success: true,
|
|
39
|
+
data: response.data || null,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return {
|
|
44
|
+
success: false,
|
|
45
|
+
error: 'Scraping failed',
|
|
46
|
+
error_type: 'ScrapingFailed',
|
|
47
|
+
timestamp: new Date().toISOString(),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
53
|
+
return {
|
|
54
|
+
success: false,
|
|
55
|
+
error: errorMessage,
|
|
56
|
+
error_type: error instanceof Error ? error.constructor.name : 'UnknownError',
|
|
57
|
+
timestamp: new Date().toISOString(),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=crawl-crawl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crawl-crawl.js","sourceRoot":"","sources":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OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,iBAAiB;wBACxB,UAAU,EAAE,gBAAgB;wBAC5B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;qBACpC,CAAC;gBACJ,CAAC;YACH,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACxB,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;gBACpE,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,YAAY;oBACnB,UAAU,EACR,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;oBAClE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBACpC,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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("@taskmagic/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
exports.crawlScrapeApi = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: auth_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 browserOptions = {
|
|
24
|
+
proxy_country: 'ANY',
|
|
25
|
+
session_name: 'Crawl',
|
|
26
|
+
session_recording: true,
|
|
27
|
+
session_ttl: 900,
|
|
28
|
+
};
|
|
29
|
+
const response = yield client_1.scrapelessCommon.crawlScrapeUrl(auth, propsValue.url, { browserOptions });
|
|
30
|
+
if ((response === null || response === void 0 ? void 0 : response.status) === 'completed' && (response === null || response === void 0 ? void 0 : response.data)) {
|
|
31
|
+
return {
|
|
32
|
+
success: true,
|
|
33
|
+
data: response.data || null,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return {
|
|
38
|
+
success: false,
|
|
39
|
+
error: 'Scraping failed',
|
|
40
|
+
error_type: 'ScrapingFailed',
|
|
41
|
+
timestamp: new Date().toISOString(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
47
|
+
return {
|
|
48
|
+
success: false,
|
|
49
|
+
error: errorMessage,
|
|
50
|
+
error_type: error instanceof Error ? error.constructor.name : 'UnknownError',
|
|
51
|
+
timestamp: new Date().toISOString(),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
//# 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,kEAAqE;AACrE,yCAAmD;AACnD,6CAAoD;AAEvC,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,wBAAiB;IACvB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,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CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;oBAClE,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("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
q: import("@taskmagic/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
hl: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
gl: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,58 @@
|
|
|
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("@taskmagic/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
exports.googleSearchApi = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: auth_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 data = yield client_1.scrapelessCommon.runScraperTask(auth, 'scraper.google.search', {
|
|
37
|
+
q: propsValue.q,
|
|
38
|
+
hl: propsValue.hl,
|
|
39
|
+
gl: propsValue.gl,
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
success: true,
|
|
43
|
+
data: data || null,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
48
|
+
return {
|
|
49
|
+
success: false,
|
|
50
|
+
error: errorMessage,
|
|
51
|
+
error_type: error instanceof Error ? error.constructor.name : 'UnknownError',
|
|
52
|
+
timestamp: new Date().toISOString(),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
//# 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,kEAAqE;AACrE,yCAAmD;AACnD,6CAAoD;AAEvC,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,wBAAiB;IACvB,IAAI,EAAE,mBAAmB;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BAClE,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("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
q: import("@taskmagic/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
data_type: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
date: import("@taskmagic/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
hl: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
tz: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.googleTrendsApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
exports.googleTrendsApi = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_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 data = yield client_1.scrapelessCommon.runScraperTask(auth, 'scraper.google.trends', {
|
|
53
|
+
q: propsValue.q,
|
|
54
|
+
data_type: propsValue.data_type,
|
|
55
|
+
date: propsValue.date,
|
|
56
|
+
hl: propsValue.hl,
|
|
57
|
+
tz: propsValue.tz,
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
success: true,
|
|
61
|
+
data: data || null,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
66
|
+
return {
|
|
67
|
+
success: false,
|
|
68
|
+
error: errorMessage,
|
|
69
|
+
error_type: error instanceof Error ? error.constructor.name : 'UnknownError',
|
|
70
|
+
timestamp: new Date().toISOString(),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
//# 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":";;;;AAAA,kEAAqE;AACrE,yCAAmD;AACnD,4CAA2D;AAC3D,6CAAoD;AAEvC,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,wBAAiB;IACvB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,8DAA8D;IAC3E,KAAK,EAAE;QACL,CAAC,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACpB,WAAW,EAAE,cAAc;YAC3B,WAAW,EACT,wUAAwU;YAC1U,YAAY,EAAE,sBAAsB;YACpC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACjC,WAAW,EAAE,WAAW;YACxB,WAAW,EAC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YAAY;oBACnB,UAAU,EACR,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;oBAClE,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("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
url: import("@taskmagic/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
js_render: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
|
|
4
|
+
headless: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
|
|
5
|
+
country: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
6
|
+
js_instructions: import("@taskmagic/pieces-framework").JsonProperty<false>;
|
|
7
|
+
block: import("@taskmagic/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("@taskmagic/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
exports.universalScrapingApi = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_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: {
|
|
46
|
+
resources: ['image', 'font', 'script'],
|
|
47
|
+
urls: ['https://example.com'],
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
},
|
|
51
|
+
run(_a) {
|
|
52
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
|
|
53
|
+
try {
|
|
54
|
+
const data = yield client_1.scrapelessCommon.universalScrape(auth, {
|
|
55
|
+
actor: 'unlocker.webunlocker',
|
|
56
|
+
input: {
|
|
57
|
+
url: propsValue.url,
|
|
58
|
+
js_render: propsValue.js_render,
|
|
59
|
+
headless: propsValue.headless,
|
|
60
|
+
js_instructions: propsValue.js_instructions,
|
|
61
|
+
block: propsValue.block,
|
|
62
|
+
},
|
|
63
|
+
proxy: {
|
|
64
|
+
country: propsValue.country,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
success: true,
|
|
69
|
+
data: data || 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,kEAAqE;AACrE,yCAAmD;AACnD,4CAAmD;AACnD,6CAAoD;AAEvC,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,wBAAiB;IACvB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EACT,iGAAiG;IACnG,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;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|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const scrapelessApiAuth: import("@taskmagic/pieces-framework").SecretTextProperty<true>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scrapelessApiAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const client_1 = require("./client");
|
|
8
|
+
exports.scrapelessApiAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
9
|
+
displayName: 'API Key',
|
|
10
|
+
description: `You can obtain your API key from [Dashboard](https://app.scrapeless.com).`,
|
|
11
|
+
required: true,
|
|
12
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
13
|
+
if (!auth) {
|
|
14
|
+
return { valid: false, error: 'API key is required' };
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
18
|
+
url: `${client_1.SCRAPELESS_BASE_URL}/api/v1/me`,
|
|
19
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
20
|
+
headers: {
|
|
21
|
+
'x-api-token': auth,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
if (response.status !== 200) {
|
|
25
|
+
return { valid: false, error: 'Invalid API key' };
|
|
26
|
+
}
|
|
27
|
+
return { valid: true };
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
31
|
+
return {
|
|
32
|
+
valid: false,
|
|
33
|
+
error: `API key validation failed: ${errorMessage}`,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/scrapeless/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,kEAAwD;AACxD,4DAAkE;AAClE,qCAA+C;AAElC,QAAA,iBAAiB,GAAG,4BAAS,CAAC,UAAU,CAAC;IACpD,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,2EAA2E;IACxF,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC;QACxD,CAAC;QACD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,GAAG,EAAE,GAAG,4BAAmB,YAAY;gBACvC,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,OAAO,EAAE;oBACP,aAAa,EAAE,IAAc;iBAC9B;aACF,CAAC,CAAC;YACH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;YACpD,CAAC;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;YACpE,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,8BAA8B,YAAY,EAAE;aACpD,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const SCRAPELESS_BASE_URL = "https://api.scrapeless.com";
|
|
2
|
+
declare function runScraperTask(apiKey: string, actor: string, input: Record<string, unknown>): Promise<any>;
|
|
3
|
+
declare function universalScrape(apiKey: string, request: Record<string, unknown>): Promise<any>;
|
|
4
|
+
declare function crawlScrapeUrl(apiKey: string, url: string, params: Record<string, unknown>): Promise<any>;
|
|
5
|
+
declare function crawlCrawlUrl(apiKey: string, url: string, params: Record<string, unknown>): Promise<any>;
|
|
6
|
+
export declare const scrapelessCommon: {
|
|
7
|
+
runScraperTask: typeof runScraperTask;
|
|
8
|
+
universalScrape: typeof universalScrape;
|
|
9
|
+
crawlScrapeUrl: typeof crawlScrapeUrl;
|
|
10
|
+
crawlCrawlUrl: typeof crawlCrawlUrl;
|
|
11
|
+
};
|
|
12
|
+
export {};
|