@@ -9,11 +9,11 @@ Official JavaScript/TypeScript SDK for the ScrapeGraph AI API - Smart web scrapi
99
1010## 🚀 Features
1111
12- - ✨ Smart web scraping with AI
13- - 🔄 Fully asynchronous design
14- - 🔍 Detailed error handling
15- - ⚡ Automatic retries and logging
16- - 🔐 Secure API authentication
12+ - ✨ Smart web scraping with AI
13+ - 🔄 Fully asynchronous design
14+ - 🔍 Detailed error handling
15+ - ⚡ Automatic retries and logging
16+ - 🔐 Secure API authentication
1717
1818## 📦 Installation
1919
@@ -23,11 +23,10 @@ Install the package using npm or yarn:
2323# Using npm
2424npm i scrapegraph-js
2525
26- # Using yarn
26+ # Using yarn
2727yarn add scrapegraph-js
2828```
2929
30-
3130## 🔧 Quick Start
3231
3332> ** Note** : Store your API keys securely in environment variables. Use ` .env ` files and libraries like ` dotenv ` to load them into your app.
@@ -36,7 +35,6 @@ yarn add scrapegraph-js
3635
3736``` javascript
3837import { smartScraper } from ' scrapegraph-js' ;
39- import ' dotenv/config' ;
4038
4139// Initialize variables
4240const apiKey = process .env .SGAI_APIKEY ; // Set your API key as an environment variable
@@ -77,6 +75,7 @@ const prompt = 'Extract the main heading and description.';
7775```
7876
7977#### Scraping with Custom Output Schema
78+
8079> [ !NOTE]
8180> To use this feature, it is necessary to employ the [ Zod] ( https://www.npmjs.com/package/zod ) package for schema creation.
8281
@@ -85,7 +84,6 @@ Here is a real-world example:
8584``` javascript
8685import { smartScraper } from ' scrapegraph-js' ;
8786import { z } from ' zod' ;
88- import ' dotenv/config' ;
8987
9088const apiKey = ' your-api-key' ;
9189const url = ' https://scrapegraphai.com/' ;
@@ -94,7 +92,7 @@ const prompt = 'What does the company do? and ';
9492const schema = z .object ({
9593 title: z .string ().describe (' The title of the webpage' ),
9694 description: z .string ().describe (' The description of the webpage' ),
97- summary: z .string ().describe (' A brief summary of the webpage' )
95+ summary: z .string ().describe (' A brief summary of the webpage' ),
9896});
9997
10098(async () => {
@@ -107,6 +105,25 @@ const schema = z.object({
107105})();
108106```
109107
108+ ### Markdownify
109+ Converts a webpage into clean, well-structured markdown format.
110+ ``` javascript
111+ import { smartScraper } from ' scrapegraph-js' ;
112+
113+ const apiKey = " your_api_key" ;
114+ const url = ' https://scrapegraphai.com/' ;
115+
116+ (async () => {
117+ try {
118+ const response = await markdownify (apiKey, url);
119+ console .log (response);
120+ } catch (error) {
121+ console .error (error);
122+ }
123+ })();
124+ ```
125+
126+
110127### Checking API Credits
111128
112129``` javascript
@@ -153,12 +170,14 @@ For detailed documentation, visit [docs.scrapegraphai.com](https://docs.scrapegr
153170### Setup
154171
1551721 . Clone the repository:
173+
156174 ``` bash
157175 git clone https://github.com/ScrapeGraphAI/scrapegraph-sdk.git
158176 cd scrapegraph-sdk/scrapegraph-js
159177 ```
160178
1611792 . Install dependencies:
180+
162181 ``` bash
163182 npm install
164183 ```
@@ -187,22 +206,22 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
187206
188207Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
189208
190- 1 . Fork the repository
191- 2 . Create your feature branch (` git checkout -b feature/AmazingFeature ` )
192- 3 . Commit your changes (` git commit -m 'Add some AmazingFeature' ` )
193- 4 . Push to the branch (` git push origin feature/AmazingFeature ` )
194- 5 . Open a Pull Request
209+ 1 . Fork the repository
210+ 2 . Create your feature branch (` git checkout -b feature/AmazingFeature ` )
211+ 3 . Commit your changes (` git commit -m 'Add some AmazingFeature' ` )
212+ 4 . Push to the branch (` git push origin feature/AmazingFeature ` )
213+ 5 . Open a Pull Request
195214
196215## 🔗 Links
197216
198- - [ Website] ( https://scrapegraphai.com )
199- - [ Documentation] ( https://scrapegraphai.com/documentation )
200- - [ GitHub] ( https://github.com/ScrapeGraphAI/scrapegraph-sdk )
217+ - [ Website] ( https://scrapegraphai.com )
218+ - [ Documentation] ( https://scrapegraphai.com/documentation )
219+ - [ GitHub] ( https://github.com/ScrapeGraphAI/scrapegraph-sdk )
201220
202221## 💬 Support
203222
204- 205- - 💻 GitHub Issues: [ Create an issue] ( https://github.com/ScrapeGraphAI/scrapegraph-sdk/issues )
223+ 224+ - 💻 GitHub Issues: [ Create an issue] ( https://github.com/ScrapeGraphAI/scrapegraph-sdk/issues )
206225- 🌟 Feature Requests: [ Request a feature] ( https://github.com/ScrapeGraphAI/scrapegraph-sdk/issues/new )
207226
208227---
0 commit comments