diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a63115f..896f6cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v4.4.0 with: node-version: ${{ matrix.node-version }} cache: 'npm' diff --git a/README.md b/README.md index 602bc8c..5ee7ca6 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ async function get(url) { device: 'desktop', // Use some data extraction rules extract_rules: { title: 'h1' }, + // Use AI data extraction rules + ai_extract_rules: { summary: '5 words summary of the post' }, // Wrap response in JSON json_response: false, // JavaScript scenario to execute (clicking on button, scrolling ...) diff --git a/dist/index.d.ts b/dist/index.d.ts index c04ce17..ccc24d6 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -7,6 +7,9 @@ export declare type SpbParams = { custom_google?: boolean; device?: string; extract_rules?: object | string; + ai_extract_rules?: { + summary: string; + }; forward_headers?: boolean; forward_headers_pure?: boolean; js_scenario?: object | string; diff --git a/dist/utils.js b/dist/utils.js index f6e9456..a744c45 100644 --- a/dist/utils.js +++ b/dist/utils.js @@ -45,6 +45,7 @@ function process_params(params) { break; case 'extract_rules': case 'js_scenario': + case 'ai_extract_rules': clean_params[key] = typeof params[key] === 'string' ? params[key] : process_json_stringify_param(params[key]); break; diff --git a/package-lock.json b/package-lock.json index ccf51cc..4a43328 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "scrapingbee", - "version": "1.7.4", + "version": "1.7.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "scrapingbee", - "version": "1.7.4", + "version": "1.7.5", "license": "ISC", "dependencies": { "axios": "^1.7", @@ -3809,7 +3809,8 @@ "version": "5.3.1", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", - "dev": true + "dev": true, + "requires": {} }, "ajv": { "version": "6.12.6", @@ -4292,7 +4293,8 @@ "version": "8.3.0", "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz", "integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==", - "dev": true + "dev": true, + "requires": {} }, "eslint-import-resolver-node": { "version": "0.3.4", diff --git a/package.json b/package.json index 5e59cee..f15e39f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scrapingbee", - "version": "1.7.5", + "version": "1.7.6", "description": "ScrapingBee Node SDK", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/index.ts b/src/index.ts index e70f0d5..b18019a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,6 +13,7 @@ export type SpbParams = { custom_google?: boolean; device?: string; extract_rules?: object | string; + ai_extract_rules?: { summary: string }; forward_headers?: boolean; forward_headers_pure?: boolean; js_scenario?: object | string; diff --git a/src/utils.ts b/src/utils.ts index a843c25..466114e 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -51,6 +51,7 @@ export function process_params(params: Record) { break; case 'extract_rules': case 'js_scenario': + case 'ai_extract_rules': clean_params[key] = typeof params[key] === 'string' ? params[key] : process_json_stringify_param(params[key]); break; diff --git a/src/version.ts b/src/version.ts index f8744e4..7866235 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const LIB_VERSION = "1.7.5"; +export const LIB_VERSION = "1.7.6";