@activepieces/piece-scrapegrapghai 0.1.4 → 0.1.5
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/package.json +11 -22
- package/src/index.d.ts +1 -1
- package/src/index.d.ts.map +1 -0
- package/src/index.js +4 -33
- package/src/index.js.map +1 -1
- package/src/lib/actions/local-scraper.d.ts +1 -0
- package/src/lib/actions/local-scraper.d.ts.map +1 -0
- package/src/lib/actions/local-scraper.js +4 -2
- package/src/lib/actions/local-scraper.js.map +1 -1
- package/src/lib/actions/markdownify.d.ts +1 -0
- package/src/lib/actions/markdownify.d.ts.map +1 -0
- package/src/lib/actions/markdownify.js +4 -2
- package/src/lib/actions/markdownify.js.map +1 -1
- package/src/lib/actions/smart-scraper.d.ts +1 -0
- package/src/lib/actions/smart-scraper.d.ts.map +1 -0
- package/src/lib/actions/smart-scraper.js +4 -2
- package/src/lib/actions/smart-scraper.js.map +1 -1
- package/src/lib/auth.d.ts +2 -0
- package/src/lib/auth.d.ts.map +1 -0
- package/src/lib/auth.js +44 -0
- package/src/lib/auth.js.map +1 -0
- package/README.md +0 -33
package/package.json
CHANGED
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-scrapegrapghai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"main": "./src/index.js",
|
|
5
|
+
"types": "./src/index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
8
|
+
"lint": "eslint 'src/**/*.ts'"
|
|
9
|
+
},
|
|
4
10
|
"dependencies": {
|
|
5
|
-
"@
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"axios-retry": "4.4.1",
|
|
9
|
-
"deepmerge-ts": "7.1.0",
|
|
10
|
-
"form-data": "4.0.4",
|
|
11
|
-
"mime-types": "2.1.35",
|
|
12
|
-
"nanoid": "3.3.8",
|
|
13
|
-
"semver": "7.6.0",
|
|
14
|
-
"socket.io-client": "4.8.1",
|
|
15
|
-
"zod": "4.1.13",
|
|
16
|
-
"@activepieces/pieces-common": "0.11.6",
|
|
17
|
-
"@activepieces/pieces-framework": "0.25.4",
|
|
18
|
-
"@activepieces/shared": "0.37.0",
|
|
11
|
+
"@activepieces/pieces-common": "0.12.3",
|
|
12
|
+
"@activepieces/pieces-framework": "0.30.0",
|
|
13
|
+
"@activepieces/shared": "0.87.1",
|
|
19
14
|
"tslib": "2.6.2"
|
|
20
|
-
}
|
|
21
|
-
"resolutions": {
|
|
22
|
-
"rollup": "npm:@rollup/wasm-node"
|
|
23
|
-
},
|
|
24
|
-
"types": "./src/index.d.ts",
|
|
25
|
-
"main": "./src/index.js",
|
|
26
|
-
"type": "commonjs"
|
|
15
|
+
}
|
|
27
16
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const scrapegraphaiAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
2
1
|
export declare const scrapegraphai: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,aAAa,mHAqBxB,CAAC"}
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scrapegraphai =
|
|
3
|
+
exports.scrapegraphai = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
6
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
@@ -8,6 +8,7 @@ const shared_1 = require("@activepieces/shared");
|
|
|
8
8
|
const smart_scraper_1 = require("./lib/actions/smart-scraper");
|
|
9
9
|
const local_scraper_1 = require("./lib/actions/local-scraper");
|
|
10
10
|
const markdownify_1 = require("./lib/actions/markdownify");
|
|
11
|
+
const auth_1 = require("./lib/auth");
|
|
11
12
|
const markdownDescription = `
|
|
12
13
|
Follow these steps to obtain your ScrapeGraphAI API Key:
|
|
13
14
|
|
|
@@ -15,36 +16,6 @@ Follow these steps to obtain your ScrapeGraphAI API Key:
|
|
|
15
16
|
2. Log in and navigate to your dashboard.
|
|
16
17
|
3. Locate and copy your API key from the dashboard.
|
|
17
18
|
`;
|
|
18
|
-
exports.scrapegraphaiAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
19
|
-
description: markdownDescription,
|
|
20
|
-
displayName: 'API Key',
|
|
21
|
-
required: true,
|
|
22
|
-
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
23
|
-
try {
|
|
24
|
-
yield pieces_common_1.httpClient.sendRequest({
|
|
25
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
26
|
-
url: 'https://api.scrapegraphai.com/v1/smartscraper',
|
|
27
|
-
headers: {
|
|
28
|
-
'Content-Type': 'application/json',
|
|
29
|
-
'SGAI-APIKEY': auth,
|
|
30
|
-
},
|
|
31
|
-
body: {
|
|
32
|
-
user_prompt: 'test',
|
|
33
|
-
website_url: 'https://www.example.com',
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
return {
|
|
37
|
-
valid: true,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
return {
|
|
42
|
-
valid: false,
|
|
43
|
-
error: 'Invalid API Key',
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}),
|
|
47
|
-
});
|
|
48
19
|
exports.scrapegraphai = (0, pieces_framework_1.createPiece)({
|
|
49
20
|
displayName: 'ScrapeGraphAI',
|
|
50
21
|
description: 'AI-powered web scraping and content extraction.',
|
|
@@ -52,14 +23,14 @@ exports.scrapegraphai = (0, pieces_framework_1.createPiece)({
|
|
|
52
23
|
logoUrl: 'https://cdn.activepieces.com/pieces/scrapegraphai.jpg',
|
|
53
24
|
categories: [shared_1.PieceCategory.ARTIFICIAL_INTELLIGENCE],
|
|
54
25
|
authors: ["OsamaHaikal"],
|
|
55
|
-
auth:
|
|
26
|
+
auth: auth_1.scrapegraphaiAuth,
|
|
56
27
|
actions: [
|
|
57
28
|
smart_scraper_1.smartScraper,
|
|
58
29
|
local_scraper_1.localScraper,
|
|
59
30
|
markdownify_1.markdownify,
|
|
60
31
|
(0, pieces_common_1.createCustomApiCallAction)({
|
|
61
32
|
baseUrl: () => 'https://api.scrapegraphai.com/v1',
|
|
62
|
-
auth:
|
|
33
|
+
auth: auth_1.scrapegraphaiAuth,
|
|
63
34
|
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
64
35
|
return ({
|
|
65
36
|
'SGAI-APIKEY': `${auth.secret_text}`,
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAgG;AAChG,qEAAwE;AACxE,iDAAqD;AACrD,+DAA2D;AAC3D,+DAA2D;AAC3D,2DAAwD;AACxD,qCAA+C;AAE/C,MAAM,mBAAmB,GAAG;;;;;;CAM3B,CAAC;AAEW,QAAA,aAAa,GAAG,IAAA,8BAAW,EAAC;IACvC,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,iDAAiD;IAC9D,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,uDAAuD;IAChE,UAAU,EAAE,CAAC,sBAAa,CAAC,uBAAuB,CAAC;IACnD,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,IAAI,EAAE,wBAAiB;IACvB,OAAO,EAAE;QACP,4BAAY;QACZ,4BAAY;QACZ,yBAAW;QACX,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,kCAAkC;YACjD,IAAI,EAAE,wBAAiB;YACvB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;iBACrC,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -3,3 +3,4 @@ export declare const localScraper: import("@activepieces/pieces-framework").IAct
|
|
|
3
3
|
user_prompt: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
4
4
|
output_schema: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
5
5
|
}>;
|
|
6
|
+
//# sourceMappingURL=local-scraper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-scraper.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/local-scraper.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;;;EAyCvB,CAAC"}
|
|
@@ -4,12 +4,14 @@ exports.localScraper = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
8
|
exports.localScraper = (0, pieces_framework_1.createAction)({
|
|
9
9
|
name: 'local_scraper',
|
|
10
10
|
displayName: 'Local Scraper',
|
|
11
11
|
description: 'Extract content from HTML content using AI by providing a natural language prompt.',
|
|
12
|
-
|
|
12
|
+
audience: 'both',
|
|
13
|
+
aiMetadata: { description: 'Uses AI to extract information described in a natural-language prompt from raw HTML you supply directly (max 2MB); optionally pass an output schema to shape the result into structured fields. Choose this when you already have the page HTML in hand and do not want the service to fetch a URL — for a live URL use Smart Scraper instead. Read-only and safe to retry.', idempotent: true },
|
|
14
|
+
auth: auth_1.scrapegraphaiAuth,
|
|
13
15
|
props: {
|
|
14
16
|
website_html: pieces_framework_1.Property.LongText({
|
|
15
17
|
displayName: 'HTML Content',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-scraper.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"local-scraper.js","sourceRoot":"","sources":["../../../../src/lib/actions/local-scraper.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAA4C;AAE/B,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,oFAAoF;IACjG,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,6WAA6W,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5Z,IAAI,EAAE,wBAAiB;IACvB,KAAK,EAAE;QACL,YAAY,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC9B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,oEAAoE;YACjF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,IAAI,CAAC;YAC3B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,+CAA+C;YAC5D,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,+CAA+C;gBACpD,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,aAAa,EAAE,IAAI,CAAC,WAAW;iBAChC;gBACD,IAAI,EAAE;oBACJ,YAAY,EAAE,UAAU,CAAC,YAAY;oBACrC,WAAW,EAAE,UAAU,CAAC,WAAW;oBACnC,aAAa,EAAE,UAAU,CAAC,aAAa;iBACxC;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const markdownify: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
2
|
website_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
}>;
|
|
4
|
+
//# sourceMappingURL=markdownify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdownify.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/markdownify.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW;;EA6BtB,CAAC"}
|
|
@@ -4,12 +4,14 @@ exports.markdownify = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
8
|
exports.markdownify = (0, pieces_framework_1.createAction)({
|
|
9
9
|
name: 'markdownify',
|
|
10
10
|
displayName: 'Convert to Markdown',
|
|
11
11
|
description: 'Convert any webpage into clean, readable Markdown format.',
|
|
12
|
-
|
|
12
|
+
audience: 'both',
|
|
13
|
+
aiMetadata: { description: 'Fetches a webpage by URL and returns its content as clean, readable Markdown. Choose this when you need the whole page as text for an LLM or document rather than a targeted extraction — use Smart Scraper instead when you want specific fields described by a prompt. Requires a public URL; read-only and safe to retry.', idempotent: true },
|
|
14
|
+
auth: auth_1.scrapegraphaiAuth,
|
|
13
15
|
props: {
|
|
14
16
|
website_url: pieces_framework_1.Property.ShortText({
|
|
15
17
|
displayName: 'Website URL',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdownify.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"markdownify.js","sourceRoot":"","sources":["../../../../src/lib/actions/markdownify.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAA4C;AAE/B,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,2DAA2D;IACxE,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,8TAA8T,EAAE,UAAU,EAAE,IAAI,EAAE;IAC7W,IAAI,EAAE,wBAAiB;IACvB,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,8CAA8C;gBACnD,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,aAAa,EAAE,IAAI,CAAC,WAAW;iBAChC;gBACD,IAAI,EAAE;oBACJ,WAAW,EAAE,UAAU,CAAC,WAAW;iBACpC;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -3,3 +3,4 @@ export declare const smartScraper: import("@activepieces/pieces-framework").IAct
|
|
|
3
3
|
user_prompt: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
4
4
|
output_schema: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
5
5
|
}>;
|
|
6
|
+
//# sourceMappingURL=smart-scraper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smart-scraper.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/smart-scraper.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;;;EAyCvB,CAAC"}
|
|
@@ -4,12 +4,14 @@ exports.smartScraper = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
8
|
exports.smartScraper = (0, pieces_framework_1.createAction)({
|
|
9
9
|
name: 'smart_scraper',
|
|
10
10
|
displayName: 'Smart Scraper',
|
|
11
11
|
description: 'Extract content from a webpage using AI by providing a natural language prompt.',
|
|
12
|
-
|
|
12
|
+
audience: 'both',
|
|
13
|
+
aiMetadata: { description: 'Fetches a live webpage by URL and uses AI to extract the information described in a natural-language prompt; optionally pass an output schema to shape the result into structured fields. Choose this when you have a public URL and want targeted data from it rather than the full raw page. The page is fetched server-side from the given URL; for HTML you already hold, use Local Scraper instead. Read-only and safe to retry.', idempotent: true },
|
|
14
|
+
auth: auth_1.scrapegraphaiAuth,
|
|
13
15
|
props: {
|
|
14
16
|
website_url: pieces_framework_1.Property.ShortText({
|
|
15
17
|
displayName: 'Website URL',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-scraper.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"smart-scraper.js","sourceRoot":"","sources":["../../../../src/lib/actions/smart-scraper.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAA4C;AAE/B,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,iFAAiF;IAC9F,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,uaAAua,EAAE,UAAU,EAAE,IAAI,EAAE;IACtd,IAAI,EAAE,wBAAiB;IACvB,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,oEAAoE;YACjF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,IAAI,CAAC;YAC3B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,+CAA+C;YAC5D,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,+CAA+C;gBACpD,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,aAAa,EAAE,IAAI,CAAC,WAAW;iBAChC;gBACD,IAAI,EAAE;oBACJ,WAAW,EAAE,UAAU,CAAC,WAAW;oBACnC,WAAW,EAAE,UAAU,CAAC,WAAW;oBACnC,aAAa,EAAE,UAAU,CAAC,aAAa;iBACxC;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,iBAAiB,mEA4B5B,CAAC"}
|
package/src/lib/auth.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scrapegraphaiAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const markdownDescription = `
|
|
8
|
+
Follow these steps to obtain your ScrapeGraphAI API Key:
|
|
9
|
+
|
|
10
|
+
1. Visit [ScrapeGraphAI](https://scrapegraphai.com) and create an account.
|
|
11
|
+
2. Log in and navigate to your dashboard.
|
|
12
|
+
3. Locate and copy your API key from the dashboard.
|
|
13
|
+
`;
|
|
14
|
+
exports.scrapegraphaiAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
15
|
+
description: markdownDescription,
|
|
16
|
+
displayName: 'API Key',
|
|
17
|
+
required: true,
|
|
18
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
19
|
+
try {
|
|
20
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
21
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
22
|
+
url: 'https://api.scrapegraphai.com/v1/smartscraper',
|
|
23
|
+
headers: {
|
|
24
|
+
'Content-Type': 'application/json',
|
|
25
|
+
'SGAI-APIKEY': auth,
|
|
26
|
+
},
|
|
27
|
+
body: {
|
|
28
|
+
user_prompt: 'test',
|
|
29
|
+
website_url: 'https://www.example.com',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
valid: true,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
return {
|
|
38
|
+
valid: false,
|
|
39
|
+
error: 'Invalid API Key',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,+DAAqE;AAErE,MAAM,mBAAmB,GAAG;;;;;;CAM3B,CAAC;AAEW,QAAA,iBAAiB,GAAG,4BAAS,CAAC,UAAU,CAAC;IACpD,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,+CAA+C;gBACpD,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,aAAa,EAAE,IAAI;iBACpB;gBACD,IAAI,EAAE;oBACJ,WAAW,EAAE,MAAM;oBACnB,WAAW,EAAE,yBAAyB;iBACvC;aACF,CAAC,CAAC;YACH,OAAO;gBACL,KAAK,EAAE,IAAI;aACZ,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,iBAAiB;aACzB,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
package/README.md
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# ScrapeGraphAI
|
|
2
|
-
|
|
3
|
-
## Description
|
|
4
|
-
ScrapeGraphAI is a powerful web scraping and content extraction API. This piece enables integration with ScrapeGraphAI's API to perform smart scraping, local scraping, and markdown conversion.
|
|
5
|
-
|
|
6
|
-
## Actions
|
|
7
|
-
1. **Smart Scraper**: Advanced web scraping with AI-powered content extraction
|
|
8
|
-
- Automatic content detection
|
|
9
|
-
- Clean HTML output
|
|
10
|
-
- Support for dynamic websites
|
|
11
|
-
- Configurable options for content types
|
|
12
|
-
|
|
13
|
-
2. **Local Scraper**: Fast and lightweight web scraping
|
|
14
|
-
- Basic content extraction
|
|
15
|
-
- Static website support
|
|
16
|
-
- Configurable selectors
|
|
17
|
-
- Resource-efficient
|
|
18
|
-
|
|
19
|
-
3. **Markdownify**: Convert web content to clean Markdown
|
|
20
|
-
- Clean and formatted markdown output
|
|
21
|
-
- Preserves content structure
|
|
22
|
-
- Handles various content types
|
|
23
|
-
- Customizable output options
|
|
24
|
-
|
|
25
|
-
## Authentication
|
|
26
|
-
This piece requires an API key from ScrapeGraphAI. To obtain your API key:
|
|
27
|
-
1. Visit https://scrapegraphai.com
|
|
28
|
-
2. Sign up for an account
|
|
29
|
-
3. Navigate to your dashboard
|
|
30
|
-
4. Copy your API key
|
|
31
|
-
|
|
32
|
-
## Requirements
|
|
33
|
-
- ScrapeGraphAI API Key
|