Skip to content Skip to sidebar Skip to footer

How Do I Grab A Thumbnail Screenshot Of Many Websites?

I have a list of 2500 websites and need to grab a thumbnail screenshot of them. How do I do that? I could try to parse the sites either with Perl or Python, Mechanize would be a go

Solution 1:

Here is Perl solution:

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

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

From the docs:

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

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.

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

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.

Post a Comment for "How Do I Grab A Thumbnail Screenshot Of Many Websites?"