screenshot-node
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-dev screenshot-node
Usage
const screenshot = require('screenshot-node');
screenshot({
urls: [
'http://google.com',
'https://www.npmjs.com/'
],
rule: 'everyMinute',
width: 1024,
height: 768,
format: 'jpeg',
timeout: 15000,
quality: 75,
picNamePrefix: [...urls],
pathName: './pictures/'
});
Example 1
const screenshot = require('screenshot-node');
screenshot({
urls: [
'http://google.com',
'http://www.bing.com/'
]
});
or
const screenshot = require('screenshot-node');
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-node');
const rule = '0 * * * * *';
screenshot({
urls: [
'http://google.com',
'http://www.bing.com//'
],
rule
});
The same result:
Example 2
const screenshot = require('screenshot-node');
const rule = '0 * * * * *';
screenshot({
urls: [
'http://google.com',
'http://www.bing.com/'
],
picNamePrefix: [
'Rose',
'Jack'
]
});
Result:
Demo
$ npm demo
Links
https://github.com/node-schedule/node-schedule
Contributing
Contributions welcome.
Author
Jerome https://github.com/lvjinpeng0