From the minds that brought you gifshot!
Today we’re proud to open source cronshot, a node module that allows you to schedule, take, alter, and store web page screenshots.
Cronshot provides an intuitive API for scheduling time-based and/or individual screenshot tasks. This makes it extremely easy to create a customized and automated screenshot solution.
Here’s a simple example that takes a screenshot of sports.yahoo.com and saves the screenshot to the local file system
var cronshot = require('cronshot'), middleware = { 'local': require('cronshot-local') };
// Save Local File Example cronshot.startCapturing({ // The webpage URL that you would like to take a screenshot of 'url': 'http://sports.yahoo.com', // The local path where you would like to save the image 'path': __dirname, // Only takes one screenshot 'cronPattern': false, // What middleware functions to use each time a screenshot is taken 'saveMiddleware': [middleware.local] }, function(err) { // optional callback function once all screenshots have been taken if (err) { console.error(err); } });
With this release, we provide two utility libraries (middleware) that allow you to save your screenshots to the local file system and/or update your screenshots using the image manipulation library, ImageMagick:
cronshot-local
cronshot-imagemagick
If you would like to create your own small middlware libraries, please read our writing your own middleware documentation.
If you’re awesome and want to work with us on other fun projects like this, email us now at sports-jobs@yahoo-inc.com!
Happy Holidays!
Comments (0)
Sign in to post comments.