Last active
November 3, 2015 01:16
-
-
Save Ivanca/aef2e58dbbf9eb3e1bd4 to your computer and use it in GitHub Desktop.
You would have to use this with a cronjob or something of the sort
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var casper = require('casper').create({viewportSize: {width: 960, height: 600}}); | |
var fs = require('fs'); | |
casper.start('https://news.ycombinator.com/', function() { | |
var now = this.fetchText('#hnmain'); | |
var old = fs.read('old.txt'); | |
if (old !== now) { | |
casper.open('http://text-compare.com/', { | |
method: 'post', | |
data: {'text1': old, 'text2': now} | |
}).then(function () { | |
casper.captureSelector('diff' + Date.now() + '.png', '#top'); | |
// Code to notify you here, e.g. IFTTT API, mail, etc | |
}); | |
fs.write('old.txt', now, 'w'); | |
} | |
}).run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment