Skip to content

Commit 40fafb3

Browse files
committed
add: added functions examples
1 parent 0214a29 commit 40fafb3

File tree

5 files changed

+53
-0
lines changed

5 files changed

+53
-0
lines changed
File renamed without changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { getCredits } from "scrapegraph-sdk";
2+
import 'dotenv/config';
3+
4+
try {
5+
const apiKey = process.env.SGAI_APIKEY;
6+
7+
const myCredit = await getCredits(apiKey);
8+
9+
console.log(myCredit)
10+
} catch (error) {
11+
console.error(error)
12+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { getSmartScraperRequest } from "scrapegraph-sdk";
2+
import 'dotenv/config';
3+
4+
try {
5+
const apiKey = process.env.SGAI_APIKEY;
6+
const requestId = "3fa85f64-5717-4562-b3fc-2c963f66afa6"
7+
8+
const requestInfo = await getSmartScraperRequest(apiKey, requestId);
9+
10+
console.log(requestInfo);
11+
} catch (error) {
12+
console.error(error);
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { sendFeedback } from "scrapegraph-sdk";
2+
import 'dotenv/config';
3+
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.";
9+
10+
const feedback_response = await sendFeedback(apiKey, requestId, rating, feedbackMessage);
11+
console.log(feedback_response);
12+
} catch (error) {
13+
console.error(error)
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { smartScraper } from "scrapegraph-sdk";
2+
import 'dotenv/config';
3+
4+
try {
5+
const apiKey = process.env.SGAI_APIKEY;
6+
const url = "https://scrapegraphai.com";
7+
const prompt = "What does the company do?";
8+
9+
const response = await smartScraper(apiKey, url, prompt);
10+
11+
console.log(response);
12+
} catch (error) {
13+
console.error(error);
14+
}

0 commit comments

Comments
 (0)