-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6744c98
commit 1fecbc4
Showing
1 changed file
with
16 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ $ npm install got-scraping | |
``` | ||
|
||
**Note:** | ||
> - Node.js >=15.10.0 is required due to instability of HTTP/2 support in lower versions. | ||
> - Node.js >=16 is required due to instability of HTTP/2 support in lower versions. | ||
## API | ||
|
||
|
@@ -18,11 +18,22 @@ Got scraping package is built using the [`got.extend(...)`](https://github.com/s | |
Interested what's [under the hood](#under-the-hood)? | ||
|
||
```javascript | ||
const { gotScraping } = require('got-scraping'); | ||
import { gotScraping } from 'got-scraping'; | ||
|
||
gotScraping | ||
.get('https://apify.com') | ||
.then( ({ body }) => console.log(body)) | ||
.then( ({ body }) => console.log(body)); | ||
``` | ||
|
||
```javascript | ||
// If you're still using CJS and cannot use the import syntax | ||
let gotScraping; | ||
|
||
async function fetchWithGotScraping(url) { | ||
gotScraping ??= (await import('got-scraping')).gotScraping; | ||
|
||
return gotScraping.get(url); | ||
} | ||
``` | ||
### options | ||
|
@@ -34,14 +45,14 @@ Type: **`string`** | |
URL of the HTTP or HTTPS based proxy. HTTP/2 proxies are supported as well. | ||
```javascript | ||
const { gotScraping } = require('got-scraping'); | ||
import { gotScraping } from 'got-scraping'; | ||
|
||
gotScraping | ||
.get({ | ||
url: 'https://apify.com', | ||
proxyUrl: 'http://usernamed:[email protected]:1234', | ||
}) | ||
.then(({ body }) => console.log(body)) | ||
.then(({ body }) => console.log(body)); | ||
``` | ||
#### `useHeaderGenerator` | ||
|