Skip to content

Instantly share code, notes, and snippets.

@sundisee
Forked from kaid/capture_rect.js
Created October 11, 2016 03:39
Show Gist options
  • Save sundisee/8222c0c4b954b51c1a4599ce16d4711c to your computer and use it in GitHub Desktop.
Save sundisee/8222c0c4b954b51c1a4599ce16d4711c to your computer and use it in GitHub Desktop.
phantomjs批量截取网页某一区域脚本
var base = 'http://dev.kaid.me/c';
var ids = [1, 2, 3, 41, 42, 43, 51, 52, 53];
ids.forEach(function(id) {
var page = require('webpage').create(),
url = base + id,
output = 'c' + id + '.png';
page.clipRect = {top:122, left:65, width:360, height:600};
page.open(url, function (status) {
window.setTimeout(function() {
var result = page.render(output);
}, 4000)
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment