hya - good evening dear perl-folks
want to grab screenshots from sites like the following..
www.google.com
www.msnbc.com
news.bbc.co.uk
www.yahoo.com
for a mechanize-scraper i take this one here
#!/usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize::Firefox;
my $mech = new WWW::Mechanize::Firefox();
open(INPUT, "<url.txt") or die $!;
while (<INPUT>) {
chomp;
print "$_\n";
$mech->get($_);
my $png = $mech->content_as_png();
my $name = "$_";
$name =~s/^www\.//;
$name .= ".png";
open(OUTPUT, ">$name");
print OUTPUT $png;
sleep (5);
}
Well i forgot to mention that i only need to have the images as small thumbnails - so we do not have to have a very very large files...
i only need to grab a thumbnail screenshot of them. How do I do that?
my $png = $mech->content_as_png();
The line returns the given tab or the current page rendered as PNG image.
as the documentation states:
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.
Well does that have any impact on our code - can we make the code somewhat more specifical to our needs.
Note:the files i store are a bit smaller - if we limit them after fetching from the web !? aren īt they!?
BTW; Currently, the data transfer between Firefox and Perl is done Base64-encoded, isn t it. Well It would be beneficial to find what 's necessary to make JSON handle all the binary data more gracefully what do you think. Love to hear from you
Now i try to install mozrepl - if you or anybody has got some tipps on that. should i run
a. zypper in .or
b. get it as a firefox plugin
greetings