幻影捕获https网页 [英] phantom capture https webpage
本文介绍了幻影捕获https网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用phantomjs捕获一个https网页,但是生成的图像是全黑图像.我该如何解决?或者它意味着phantomjs无法捕获https网页?
I use phantomjs to capture a https webpage, but the resulting image is a whole black image. How do I fix it or does it mean phantomjs can't capture an https webpage?
像这样的代码:
var webpage = require('webpage');
var page = webpage.create();
page.open('https://twitter.com/JavaScriptDaily',function(status){
page.render('twitter.jpeg', {format: 'jpeg', quality: '100'});
phantom.exit();
});
推荐答案
以png格式渲染图像,它将解决您的问题.
Render your image in png, it will solve your problem.
var webpage = require('webpage');
var page = webpage.create();
page.open('https://twitter.com/JavaScriptDaily',function(status){
page.render('twitter.png', {format: 'png'});
phantom.exit();
});
这篇关于幻影捕获https网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文