How do I grab a thumbnail screenshot of many websites?

后端 未结 1 1994
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-21 22:16

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, Mechaniz

相关标签:
1条回答
  • 2020-12-21 23:07

    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();
    

    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.

    0 讨论(0)
提交回复
热议问题