Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: changelog for v4 #115

Merged
merged 5 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be (somewhere) a note about this project being ESM only too


## 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
Loading