Skip to content

Instantly share code, notes, and snippets.

@kaid
Last active October 11, 2016 03:39
Show Gist options
  • Save kaid/4975535 to your computer and use it in GitHub Desktop.
Save kaid/4975535 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