项目
在 GitHub 查看
fouber/page-monitor
关于
使用 PhantomJS 抓取网页,并对 DOM 变化进行差异比较 ♨
其他项目实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 0
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Page Monitor
capture webpage and diff the dom change with phantomjs
Effects
Element Add

Element Removed

Text Changed

Style Changed

Make UI to show diffs of history

Usage
First of all, install phantomjs, page-monitor relys on phantomjs to render webpage and genenrate screenshot. DO NOT use
npmto install phantomjs on winidows, it can't be launched byspawn.
var Monitor = require('page-monitor');
var url = 'http://www.google.com';
var monitor = new Monitor(url);
monitor.capture(function(code){
console.log(monitor.log); // from phantom
console.log('done, exit [' + code + ']');
});
API
Monitor
var monitor = new Monitor(url [, options]);
see the default options here: https://github.com/fouber/page-monitor/blob/master/index.js , you can override any option for your monitoring.
monitor.capture(callback [, noDiff]);
caputure webpage and save screenshot, then diff with last save.
var monitor = new Monitor(url, options);
monitor.on('debug', function (data) {
console.log('[DEBUG] ' + data);
});
monitor.on('error', function (data) {
console.error('[ERROR] ' + data);
});
monitor.capture(function(code){
console.log(monitor.log.info); // diff result
console.log('[DONE] exit [' + code + ']');
});
monitor.diff(left, right, callback);
diff change between left(date.getTime()) and right(date.getTime()).
var monitor = new Monitor(url, options);
monitor.on('debug', function (data) {
console.log('[DEBUG] ' + data);
});
monitor.on('error', function (data) {
console.error('[ERROR] ' + data);
});
monitor.diff(1408947323420, 1408947556898, function(code){
console.log(monitor.log.info); // diff result
console.log('[DONE] exit [' + code + ']');
});
events
var monitor = new Monitor(url);
monitor.on('debug', function (data) {
console.log('[DEBUG] ' + data);
});
monitor.on('error', function (data) {
console.error('[ERROR] ' + data);
});
debug: debug from phantomnotice: console from webpageinfo: info from phantomwarning: error from webpageerror: error from phantom
探索相关项目
加载中…