如何获取许多网站的缩略图屏幕快照? [英] How do I grab a thumbnail screenshot of many websites?

查看:95
本文介绍了如何获取许多网站的缩略图屏幕快照?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2500个网站的列表,需要抓取它们的缩略图.我该怎么办?

I have a list of 2500 websites and need to grab a thumbnail screenshot of them. How do I do that?

我可以尝试使用Perl或Python解析站点,Mechanize会是一件好事.但是我对Perl不太了解.

I could try to parse the sites either with Perl or Python, Mechanize would be a good thing. But I am not so experienced with Perl.

推荐答案

这是Perl解决方案:

Here is Perl solution:

  use WWW::Mechanize::Firefox;
  my $mech = WWW::Mechanize::Firefox->new();
  $mech->get('http://google.com');

  my $png = $mech->content_as_png();

从文档中:

返回给定的选项卡或呈现为的当前页面 PNG图片.

Returns the given tab or the current page rendered as PNG image.

所有参数都是可选的. $ tab默认为当前选项卡.如果 给定坐标,将切出该矩形.该坐标 应该是带有四个常用条目(左,上,宽,高)的哈希值.

All parameters are optional. $tab defaults to the current tab. If the coordinates are given, that rectangle will be cut out. The coordinates should be a hash with the four usual entries, left,top,width,height.

这特定于WWW :: Mechanize :: Firefox.

This is specific to WWW::Mechanize::Firefox.

当前,Firefox和Perl之间的数据传输已完成 Base64编码.找出必要的条件对 使JSON更优雅地处理二进制数据.

Currently, the data transfer between Firefox and Perl is done Base64-encoded. It would be beneficial to find what's necessary to make JSON handle binary data more gracefully.

这篇关于如何获取许多网站的缩略图屏幕快照?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆