Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

screenshot-phantom

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

screenshot-phantom

Timing screenshots on the websites and output pictures files in Node.js

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

screenshot-phantom

Websites screenshots timer in Node.js

中文README

Features

  • uses phantom.js
  • Screenshot output picture files
  • Multiple screenshots at the same time
  • simple api

Sketch

Regularly perform a screenshot task, the whole process of a task is: open the page => wait for resources to load => screenshots => close page => open the next page (if the screen at the same time multiple sites) ... ...

Install

npm install --save screenshot-phantom

Usage

const screenshot = require('screenshot-phantom');

screenshot({

  /*
   * Required: An array consist of websites
   */
  urls: [
    'http://google.com',
    'https://www.npmjs.com/'
  ],

  /*
   * Optional: Set the rule of screenshots timing
   * Convenient options: 'everyMinute' | 'everyHour' | 'everyDay' | 'everyWeek' | 'everyMonth'
   * or use the other options of package "node-schedule", such as '0 * * * * *' (see the "Links" for more details)
   */
  rule: 'everyMinute',

  /*
   * Optional: Set the viewport width of screenshots
   */
  width: 1024,

  /*
   * Optional: Set the viewport height of screenshots
   */
  height: 768,

  /*
   * Optional: Set the screenshots format (pdf|png|jpeg)
   */
  format: 'jpeg',

  /*
   * Optional: Set the time delay of screenshot after page loaded
   */
  timeout: 15000,

  /*
   * Optional: Set the quality of the screenshots (0-100)
   */
  quality: 75,

  /*
   * Optional: An array consist of screenshots files' prefix names that match the urls array by index, which means these two arrays have the same length
   */
  picNamePrefix: [...urls],

  /*
   * Optional: Define the path of the output screenshots
   */
  pathName: './pictures/'
});

Example 1

const screenshot = require('screenshot-phantom');

screenshot({

  urls: [
    'http://google.com',
    'http://www.bing.com/'
  ]

});

or

const screenshot = require('screenshot-phantom');
const schedule = require('node-schedule');
const rule = new schedule.RecurrenceRule();
rule.second = 0;

screenshot({

  urls: [
    'http://google.com',
    'http://www.bing.com/'
  ],
  rule

});

or

const screenshot = require('screenshot-phantom');
const rule = '0 * * * * *';

screenshot({

  urls: [
    'http://google.com',
    'http://www.bing.com//'
  ],
  rule

});

The same result:

Example 2

const screenshot = require('screenshot-phantom');
const rule = '0 * * * * *';

screenshot({

  urls: [
    'http://google.com',
    'http://www.bing.com/'
  ],
  picNamePrefix: [
    'Rose',
    'Jack'
  ]
  
});

Result:

Demo

$ npm demo

https://github.com/node-schedule/node-schedule

Contributing

Contributions welcome.

Author

Jerome https://github.com/lvjinpeng0

Keywords

FAQs

Package last updated on 18 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc