usr bin perl Table autokrone grabber use strict use LWP Simple my url

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/perl
# Table autokrone grabber
use strict;
use LWP::Simple;
my $url = "http://www.autoland-regensdorf.ch/db/";
my @bag = split(/\n/,get($url));
my @good = ();
my @img_links = ();
my $x = 0;
foreach (@bag){
$_ =~ s/B2D3E9/E7EAEB/ig; # change bg color blue => gray
$_ =~ s/0000dd/BFC5CB/ig; # change head bg color dark-blue => dark-gray
if ($_ =~ m/<img src="(.*?)"/ig){
push(@img_links,$1);
my $img_link = $1;
my @some = split(/\//, $img_link);
$_ =~ s/$img_link/uploads\/$some[-1]/ig;
}
if ($_ =~ m/<table border="0" cellspacing="5" cellpadding="3" align="center" width="100%">/ig || $x == 1){
$x = 1;
if ($_ =~ m/<font class="untertitel">/ig){
print "DEBUG: END LINE FOUND\n";
last;
}
push(@good,$_);
}
}
open Z, "+>test.html" or die $!;
my $result = "@good";
$result =~ s/Anzeigen_ID\.php\?id=\w+//ig; # Clean urls
$result =~ s/<a href="">(.*?)<\/a>/$1/ig;
print Z $result;
close Z;
&image_grabber(@img_links); # Download all thumbnails to uploads folder
sub image_grabber(){
system("rm -rf uploads/*");# Clean old images
my @imgs = @_;
my $url = "http://www.autoland-regensdorf.ch/db/";
foreach(@imgs){
my @image = split(/\//,$_);
getstore($url . $_, "uploads\/$image[-1]");
}
}