@@ -55,19 +55,19 @@ const prompt = 'What does the company do?';
55
55
56
56
## 🎯 Examples
57
57
58
- ### HTMLfy - Get HTML Content
58
+ ### Scrape - Get HTML Content
59
59
60
- #### Basic HTMLfy
60
+ #### Basic Scrape
61
61
62
62
``` javascript
63
- import { htmlfy } from ' scrapegraph-js' ;
63
+ import { scrape } from ' scrapegraph-js' ;
64
64
65
65
const apiKey = ' your-api-key' ;
66
66
const url = ' https://example.com' ;
67
67
68
68
(async () => {
69
69
try {
70
- const response = await htmlfy (apiKey, url);
70
+ const response = await scrape (apiKey, url);
71
71
console .log (' HTML content:' , response .html );
72
72
console .log (' Status:' , response .status );
73
73
} catch (error) {
@@ -76,17 +76,17 @@ const url = 'https://example.com';
76
76
})();
77
77
```
78
78
79
- #### HTMLfy with Heavy JavaScript Rendering
79
+ #### Scrape with Heavy JavaScript Rendering
80
80
81
81
``` javascript
82
- import { htmlfy } from ' scrapegraph-js' ;
82
+ import { scrape } from ' scrapegraph-js' ;
83
83
84
84
const apiKey = ' your-api-key' ;
85
85
const url = ' https://example.com' ;
86
86
87
87
(async () => {
88
88
try {
89
- const response = await htmlfy (apiKey, url, {
89
+ const response = await scrape (apiKey, url, {
90
90
renderHeavyJs: true
91
91
});
92
92
console .log (' HTML content with JS rendering:' , response .html );
@@ -96,17 +96,17 @@ const url = 'https://example.com';
96
96
})();
97
97
```
98
98
99
- #### HTMLfy with Custom Headers
99
+ #### Scrape with Custom Headers
100
100
101
101
``` javascript
102
- import { htmlfy } from ' scrapegraph-js' ;
102
+ import { scrape } from ' scrapegraph-js' ;
103
103
104
104
const apiKey = ' your-api-key' ;
105
105
const url = ' https://example.com' ;
106
106
107
107
(async () => {
108
108
try {
109
- const response = await htmlfy (apiKey, url, {
109
+ const response = await scrape (apiKey, url, {
110
110
headers: {
111
111
' User-Agent' : ' Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ,
112
112
' Cookie' : ' session=123'
@@ -119,17 +119,17 @@ const url = 'https://example.com';
119
119
})();
120
120
```
121
121
122
- #### Get HTMLfy Request Status
122
+ #### Get Scrape Request Status
123
123
124
124
``` javascript
125
- import { getHtmlfyRequest } from ' scrapegraph-js' ;
125
+ import { getScrapeRequest } from ' scrapegraph-js' ;
126
126
127
127
const apiKey = ' your-api-key' ;
128
128
const requestId = ' your-request-id' ;
129
129
130
130
(async () => {
131
131
try {
132
- const response = await getHtmlfyRequest (apiKey, requestId);
132
+ const response = await getScrapeRequest (apiKey, requestId);
133
133
console .log (' Request status:' , response .status );
134
134
if (response .status === ' completed' ) {
135
135
console .log (' HTML content:' , response .html );
@@ -482,9 +482,9 @@ const feedbackText = 'This is a test feedback message.';
482
482
483
483
## 🔧 Available Functions
484
484
485
- ### HTMLfy
485
+ ### Scrape
486
486
487
- #### ` htmlfy (apiKey, url, options)`
487
+ #### ` scrape (apiKey, url, options)`
488
488
489
489
Converts a webpage into HTML format with optional JavaScript rendering.
490
490
@@ -498,30 +498,30 @@ Converts a webpage into HTML format with optional JavaScript rendering.
498
498
** Returns:** Promise that resolves to an object containing:
499
499
- ` html ` : The HTML content of the webpage
500
500
- ` status ` : Request status ('completed', 'processing', 'failed')
501
- - ` htmlfy_request_id ` : Unique identifier for the request
501
+ - ` scrape_request_id ` : Unique identifier for the request
502
502
- ` error ` : Error message if the request failed
503
503
504
504
** Example:**
505
505
``` javascript
506
- const response = await htmlfy (apiKey, ' https://example.com' , {
506
+ const response = await scrape (apiKey, ' https://example.com' , {
507
507
renderHeavyJs: true ,
508
508
headers: { ' User-Agent' : ' Custom Agent' }
509
509
});
510
510
```
511
511
512
- #### ` getHtmlfyRequest (apiKey, requestId)`
512
+ #### ` getScrapeRequest (apiKey, requestId)`
513
513
514
- Retrieves the status or result of a previous HTMLfy request.
514
+ Retrieves the status or result of a previous scrape request.
515
515
516
516
** Parameters:**
517
517
- ` apiKey ` (string): Your ScrapeGraph AI API key
518
- - ` requestId ` (string): The unique identifier for the HTMLfy request
518
+ - ` requestId ` (string): The unique identifier for the scrape request
519
519
520
520
** Returns:** Promise that resolves to the request result object.
521
521
522
522
** Example:**
523
523
``` javascript
524
- const result = await getHtmlfyRequest (apiKey, ' request-id-here' );
524
+ const result = await getScrapeRequest (apiKey, ' request-id-here' );
525
525
```
526
526
527
527
### Smart Scraper
0 commit comments