Node.js Screenshot Machine API 封装库

该库为 Screenshot Machine API 提供了一个便捷的 Node.js 封装,方便开发者在 Node.js 应用中使用 Screenshot Machine 服务。

安装

npm install node-screenshot-machine

git clone 
cd node-screenshot-machine
npm install

单元测试 (可选)

npm test

使用方法

初始化 node-screenshot-machine 模块:

var screenshot = require('node-screenshot-machine')({
  key: 'your screenshotmachine API key',
});

获取网站截图:

screenshot
  .capture({
    url: 'https://www.example.com',
  })
  .then((result) => {
    // 处理截图结果
    console.log(result);
  })
  .catch((error) => {
    // 处理错误
    console.error(error);
  });
zip 文件大小:9.3KB