Skip to content

Commit

Permalink
chore: changelog for v4 (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfrangu authored Nov 7, 2023
1 parent 0ed3fdc commit 701f766
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
4.0.0 / 2023/11/07
====================
- **BREAKING**: This module is now ESM only.
- You will need to either migrate your projects to ESM, or import `got-scraping` in an async context via `await import('got-scraping');`
- Update `got` to v13

3.1.0 / 2021/08/23
====================
- Add `sessionToken` option to persist generated headers
Expand Down
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ $ npm install got-scraping
```

**Note:**
> - Node.js >=15.10.0 is required due to instability of HTTP/2 support in lower versions.
> This project is ESM only, which means it can only be imported using the `import` statement or the `import()` method. It is not possible to `require()` it.
> - Node.js >=16 is required due to instability of HTTP/2 support in lower versions.
## API

Expand All @@ -18,11 +20,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
Expand All @@ -34,14 +47,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`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "4.0.0",
"description": "HTTP client made for scraping based on got.",
"engines": {
"node": ">=18"
"node": ">=16"
},
"files": [
"dist"
Expand Down

0 comments on commit 701f766

Please sign in to comment.