Skip to content

Commit baf933b

Browse files
committed
feat: added example of the smartScraper function using a schema
1 parent 10a1a5a commit baf933b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
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+
}

0 commit comments

Comments
 (0)