node-apikit

one api for all

MIT License

Stars
32
Committers
1

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


node-apikit

Install

npm i node-apikit

NOTE: this library requires a fetch polyfill if you're running it in Node.js. Despite being named node-apikit, it actually supports browser and Deno too.

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.

import { getRealURL } from 'node-apikit'

const url = await getRealURL(url)

Arguments:

  • url: URL

seo

Get SEO information for specific URL:

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:

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