-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwallpaper_fr.pl
More file actions
85 lines (77 loc) · 1.93 KB
/
wallpaper_fr.pl
File metadata and controls
85 lines (77 loc) · 1.93 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#use stricts;
use warnings;
use LWP::Simple;
my $imageTitre;
my $index;
my $base;
my $index2;
my $ligne;
my $val1;
my $imageLine;
my $index3;
my $val2;
my $index4;
my $imageLien;
my $val3;
my $index5;
my $file;
my $val4;
my $adress;
my $verif = 0;
my $osname = $^O;
my $path;
if ($osname = "MSWin32")
{
$path = "Wallpapers\\";
}
else
{
$path = "Wallpapers/"
}
print "Outil de téléchargement de fonds d'écran Windows\nPar Jean-Yves Roda, c 1999-2015\n\nEntrez l'adresse de la page de téléchargement des fonds d'écrans Windows:\nEx: http://windows.microsoft.com/fr-fr/windows/wallpaper?T1=places\n";
$adress = <>;
chomp $adress;
print "Début du téléchargement.\n";
getstore($adress, 'wallpaper.html');
print "Téléchargement terminé\n";
open(my $fh, '<', 'wallpaper.html') or die "Impossible d'ouvrir le fichier !\nMauvais lien ?\n";
print "Début de lecture du fichier html.\n";
while (my $line = <$fh>)
{
$index = index($line, 'galleryGrid');
$base = -1;
if ($index != $base)
{
$verif = 1;
$imageLine = $line;
$index2 = index($line, 'headingM');
while($index2 != $base)
{
$val1 = $index2 + 10;
$imageTitre = substr($imageLine, $val1);
$index3 = index($imageTitre, '>');
$val2 = $index3 - 4;
$imageTitre = substr($imageTitre, 0, $val2);
print "Trouvé une image: $imageTitre.\n";
$index4 = index($imageLine, 'navigationLink');
$val3 = $index4 + 22;
$imageLien = substr($imageLine, $val3);
$index5 = index($imageLien, '>');
$val4 = $index5 - 1;
$imageLien = substr($imageLien, 0, $val4);
#print "Lien de téléchargement: $imageLien\n";
print "Début du téléchargement.\n";
$file = $path . $imageTitre . ".jpg";
getstore($imageLien, $file);
print "Téléchargement terminé.\n";
$imageLine = substr($imageLine, $val3);
$index2 = index($imageLine, 'headingM');
}
}
}
print "Lecture terminée.\n";
if($verif == 0)
{
print "Aucune image trouvée !\nMauvais lien ?\n";
}
close $fh;