1.0.0 • Published 3 years ago

node-apikit v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

💛 You can help the author become a full-time open-source maintainer by sponsoring him on GitHub.


node-apikit

npm version

Install

npm i node-apikit

NOTE: this library requires a fetch polyfill if you're running it in Node.js.

API

getHTML

Get HTML for specific URL:

import { getHTML } from 'node-apikit'

const html = await getHTML(url)

Arguments:

  • url: URL
  • options:
    • js: boolean Run JavaScript on this page, default to false

screenshot

Screenshot specific URL:

import { screenshot } from 'node-apikit'

const { getBuffer } = await screenshot(url)
const arrayBuffer = await getBuffer()
```

Arguments:

- `url`: URL
- `options`:
    - `fullPage`: `boolean` screenshot the full page, default to `false`

### `getRealURL`

Get the final URL, i.e. after redirection.

````ts
import { getRealURL } from 'node-apikit'

const url = await getRealURL(url)
```

Arguments:

- `url`: URL

### `seo`

Get SEO information for specific URL:

````ts
import { seo } from 'node-apikit'

const info = await seo(url)
```

Arguments:

- `url`: URL
- `options`:
    - `js`: `boolean` Run JavaScript on this page, default to `false`

Returns:

```ts
interface Info {
  title?: string
  description?: string
  image?: string
  og: {
    title?: string
    description?: string
    image?: string
  }
  twitter: {
    creator?: string
    site?: string
    title?: string
    description?: string
    image?: string
  }
}
```

## License

MIT © [EGOIST](https://github.com/sponsors/egoist)