Skip to content

Commit 9d38066

Browse files
authored
Merge pull request #10 from ScrapeGraphAI/main
Alignment
2 parents 977149f + b21d25b commit 9d38066

23 files changed

+496
-224
lines changed

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
},
1010
"author": "ScrapeGraphAI",
1111
"license": "MIT",
12-
"workspaces": [
13-
"scrapegraph-js"
14-
],
1512
"scripts": {
1613
"semantic-release": "semantic-release"
1714
},

scrapegraph-js/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules

scrapegraph-js/.prettierrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"trailingComma": "es5",
5+
"tabWidth": 2,
6+
"useTabs": false,
7+
"printWidth": 110,
8+
"bracketSpacing": true,
9+
"arrowParens": "always",
10+
"quoteProps": "preserve"
11+
}

scrapegraph-js/eslint.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import globals from 'globals';
2+
import pluginJs from '@eslint/js';
3+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
4+
5+
/** @type {import('eslint').Linter.Config[]} */
6+
export default [
7+
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
8+
pluginJs.configs.recommended,
9+
eslintPluginPrettierRecommended,
10+
{ ignorePatterns: ['node_modules/'] },
11+
];

scrapegraph-js/examples/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# ScrapegraphAI API Key
2-
SGAI-APIKEY="your ScrapegraphAI API Key"
2+
SGAI_APIKEY="your ScrapegraphAI API Key"

scrapegraph-js/examples/getCredits_example.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { getCredits } from "scrapegraph-sdk";
1+
import { getCredits } from 'scrapegraph-js';
22
import 'dotenv/config';
33

4-
try {
5-
const apiKey = process.env.SGAI_APIKEY;
4+
const apiKey = process.env.SGAI_APIKEY;
65

6+
try {
77
const myCredit = await getCredits(apiKey);
8-
98
console.log(myCredit)
109
} catch (error) {
1110
console.error(error)

scrapegraph-js/examples/getSmartScraperRequest_example.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import { getSmartScraperRequest } from "scrapegraph-sdk";
1+
import { getSmartScraperRequest } from 'scrapegraph-js';
22
import 'dotenv/config';
33

4-
try {
5-
const apiKey = process.env.SGAI_APIKEY;
6-
const requestId = '3fa85f64-5717-4562-b3fc-2c963f66afa6'
4+
const apiKey = process.env.SGAI_APIKEY;
5+
const requestId = '3fa85f64-5717-4562-b3fc-2c963f66afa6'
76

7+
try {
88
const requestInfo = await getSmartScraperRequest(apiKey, requestId);
9-
109
console.log(requestInfo);
1110
} catch (error) {
1211
console.error(error);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { smartScraper } from 'scrapegraph-js';
2+
import { z } from 'zod';
3+
import 'dotenv/config';
4+
5+
const apiKey = process.env.SGAI_APIKEY;
6+
const url = 'https://scrapegraphai.com/';
7+
const prompt = 'What does the company do? and ';
8+
9+
const schema = 2;
10+
11+
try {
12+
const response = await smartScraper(apiKey, url, prompt, schema);
13+
console.log(response.result);
14+
} catch (error) {
15+
console.error(error);
16+
}

scrapegraph-js/examples/sendFeedback_example.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { sendFeedback } from "scrapegraph-sdk";
1+
import { sendFeedback } from 'scrapegraph-js';
22
import 'dotenv/config';
33

4-
try {
5-
const apiKey = process.env.SGAI_APIKEY;
6-
const requestId = "16a63a80-c87f-4cde-b005-e6c3ecda278b";
7-
const rating = 5;
8-
const feedbackMessage = "This is a test feedback message.";
4+
const apiKey = process.env.SGAI_APIKEY;
5+
const requestId = '16a63a80-c87f-4cde-b005-e6c3ecda278b';
6+
const rating = 5;
7+
const feedbackMessage = 'This is a test feedback message.';
98

9+
try {
1010
const feedback_response = await sendFeedback(apiKey, requestId, rating, feedbackMessage);
1111
console.log(feedback_response);
1212
} catch (error) {

scrapegraph-js/examples/smartScraper_example.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { smartScraper } from "scrapegraph-sdk";
1+
import { smartScraper } from 'scrapegraph-js';
22
import 'dotenv/config';
33

4-
try {
5-
const apiKey = process.env.SGAI_APIKEY;
6-
const url = "https://scrapegraphai.com";
7-
const prompt = "What does the company do?";
4+
const apiKey = process.env.SGAI_APIKEY;
5+
const url = 'https://scrapegraphai.com';
6+
const prompt = 'What does the company do?';
87

8+
try {
99
const response = await smartScraper(apiKey, url, prompt);
10-
1110
console.log(response);
1211
} catch (error) {
1312
console.error(error);

0 commit comments

Comments
 (0)