Skip to content

Alignment #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
01ca238
refactor: code refactoring
DPende Nov 25, 2024
96649f0
add: implemented error handling
DPende Nov 25, 2024
aa27aa5
Merge branch 'main' into error-management-js
DPende Nov 28, 2024
12428e5
Merge pull request #6 from ScrapeGraphAI/pre/beta
PeriniM Nov 28, 2024
6752c43
removed unued import
VinciGit00 Nov 28, 2024
3c2178e
fix: readme js sdk
lurenss Nov 28, 2024
9e9e138
chore: changed pakage name
DPende Nov 28, 2024
88a2f50
fix: removed wrong information
DPende Nov 28, 2024
ce53675
Merge pull request #3 from ScrapeGraphAI/error-management-js
DPende Nov 28, 2024
3c9f76d
Merge pull request #7 from ScrapeGraphAI/js-readme-standardization
DPende Nov 29, 2024
b5f2d4c
ci(release): 1.2.1 [skip ci]
semantic-release-bot Nov 29, 2024
d737996
Update package.json
VinciGit00 Nov 29, 2024
46ebd9d
fix: add enw timeout
VinciGit00 Nov 29, 2024
d6e7f40
ci(release): 1.2.2 [skip ci]
semantic-release-bot Nov 29, 2024
a2b57c7
refactor: code refactoring
DPende Nov 29, 2024
1299173
fix: the "workspace" key has been removed because it was conflicting …
DPende Nov 29, 2024
ee5738b
chore: added Zod package dependency
DPende Nov 29, 2024
cf2f28f
docs: added an example of the smartScraper functionality using a schema
DPende Nov 29, 2024
10a1a5a
feat: implemented support for requests with schema
DPende Nov 29, 2024
baf933b
feat: added example of the smartScraper function using a schema
DPende Nov 29, 2024
13cf1e5
chore: set up eslint and prettier for code linting and formatting
DPende Nov 29, 2024
6a351f3
feat: add integration for env variables
VinciGit00 Nov 30, 2024
34777af
ci(release): 1.3.0 [skip ci]
semantic-release-bot Nov 30, 2024
5903759
Merge pull request #8 from ScrapeGraphAI/js-schema-implementation
DPende Nov 30, 2024
d5ce218
ci(release): 1.4.0 [skip ci]
semantic-release-bot Nov 30, 2024
38e0862
Merge branch 'main' into js-eslint-prettier-configuration
DPende Nov 30, 2024
c086da9
Merge pull request #9 from ScrapeGraphAI/js-eslint-prettier-configura…
DPende Nov 30, 2024
690e87b
fix: sync client
VinciGit00 Dec 2, 2024
bc5c6ae
ci(release): 1.4.1 [skip ci]
semantic-release-bot Dec 2, 2024
589aa49
fix: timeout
VinciGit00 Dec 2, 2024
fb6a079
ci(release): 1.4.2 [skip ci]
semantic-release-bot Dec 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
},
"author": "ScrapeGraphAI",
"license": "MIT",
"workspaces": [
"scrapegraph-js"
],
"scripts": {
"semantic-release": "semantic-release"
},
Expand Down
1 change: 1 addition & 0 deletions scrapegraph-js/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
11 changes: 11 additions & 0 deletions scrapegraph-js/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"tabWidth": 2,
"useTabs": false,
"printWidth": 110,
"bracketSpacing": true,
"arrowParens": "always",
"quoteProps": "preserve"
}
11 changes: 11 additions & 0 deletions scrapegraph-js/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';

/** @type {import('eslint').Linter.Config[]} */
export default [
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
pluginJs.configs.recommended,
eslintPluginPrettierRecommended,
{ ignorePatterns: ['node_modules/'] },
];
2 changes: 1 addition & 1 deletion scrapegraph-js/examples/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# ScrapegraphAI API Key
SGAI-APIKEY="your ScrapegraphAI API Key"
SGAI_APIKEY="your ScrapegraphAI API Key"
7 changes: 3 additions & 4 deletions scrapegraph-js/examples/getCredits_example.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { getCredits } from "scrapegraph-sdk";
import { getCredits } from 'scrapegraph-js';
import 'dotenv/config';

try {
const apiKey = process.env.SGAI_APIKEY;
const apiKey = process.env.SGAI_APIKEY;

try {
const myCredit = await getCredits(apiKey);

console.log(myCredit)
} catch (error) {
console.error(error)
Expand Down
9 changes: 4 additions & 5 deletions scrapegraph-js/examples/getSmartScraperRequest_example.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { getSmartScraperRequest } from "scrapegraph-sdk";
import { getSmartScraperRequest } from 'scrapegraph-js';
import 'dotenv/config';

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

try {
const requestInfo = await getSmartScraperRequest(apiKey, requestId);

console.log(requestInfo);
} catch (error) {
console.error(error);
Expand Down
16 changes: 16 additions & 0 deletions scrapegraph-js/examples/schema_smartScraper_example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { smartScraper } from 'scrapegraph-js';
import { z } from 'zod';
import 'dotenv/config';

const apiKey = process.env.SGAI_APIKEY;
const url = 'https://scrapegraphai.com/';
const prompt = 'What does the company do? and ';

const schema = 2;

try {
const response = await smartScraper(apiKey, url, prompt, schema);
console.log(response.result);
} catch (error) {
console.error(error);
}
12 changes: 6 additions & 6 deletions scrapegraph-js/examples/sendFeedback_example.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { sendFeedback } from "scrapegraph-sdk";
import { sendFeedback } from 'scrapegraph-js';
import 'dotenv/config';

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

try {
const feedback_response = await sendFeedback(apiKey, requestId, rating, feedbackMessage);
console.log(feedback_response);
} catch (error) {
Expand Down
11 changes: 5 additions & 6 deletions scrapegraph-js/examples/smartScraper_example.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { smartScraper } from "scrapegraph-sdk";
import { smartScraper } from 'scrapegraph-js';
import 'dotenv/config';

try {
const apiKey = process.env.SGAI_APIKEY;
const url = "https://scrapegraphai.com";
const prompt = "What does the company do?";
const apiKey = process.env.SGAI_APIKEY;
const url = 'https://scrapegraphai.com';
const prompt = 'What does the company do?';

try {
const response = await smartScraper(apiKey, url, prompt);

console.log(response);
} catch (error) {
console.error(error);
Expand Down
45 changes: 41 additions & 4 deletions scrapegraph-js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 16 additions & 4 deletions scrapegraph-js/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
"name": "scrapegraph-sdk",
"name": "scrapegraph-js",
"author": "ScrapeGraphAI",
"version": "0.0.1",
"description": "Scrape and extract structured data from a webpage using ScrapeGraph AI.",
"description": "Scrape and extract structured data from a webpage using ScrapeGraphAI's APIs.",
"repository": {
"type": "git",
"url": "https://github.com/ScrapeGraphAI/scrapegraph-sdk",
"directory": "scrapegraph-js"
},
"scripts": {
"format": "prettier --write --cache --cache-strategy metadata . !dist",
"lint": "eslint ."
},
"license": "MIT",
"homepage": "https://github.com/ScrapeGraphAI/scrapegraph-sdk/tree/main/scrapegraph-js",
"keywords": [
Expand All @@ -23,9 +27,17 @@
"module": "index.js",
"type": "module",
"dependencies": {
"axios": "^1.6.0"
"axios": "^1.6.0",
"zod": "^3.23.8",
"zod-to-json-schema": "^3.23.5"
},
"devDependencies": {
"dotenv": "^16.4.5"
"@eslint/js": "^9.16.0",
"dotenv": "^16.4.5",
"eslint": "^9.16.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"globals": "^15.12.0",
"prettier": "3.4.1"
}
}
Loading