Hey,
inspiriert durch porndump.pl von Bonkers, habe ich ein ähnliches Script für mobile.sciphone.net geschrieben. Die Seite bietet Hintergrundbilder aus verschiedenen Kategorien für das iPhone an. Mein Skript zieht ein beliebige Anzahl an Bildern aus einer der Kategorien.
Würde mich über C & C und Bugs freuen ![Biggrin](images/smilies/biggrin.png)
Code:
#!/usr/bin/perl -w
use LWP::Simple;
print " --------------------------------------------------------------------------\n";
print " mobile.sciphone.net image dumper 0.1 \n";
print " coded by N0n3 2/23/10\n";
print " use this tool to dump pictures from mobile.sciphone.net\n";
print " ";
print " --------------------------------------------------------------------------\n";
printCategoryIDs();
print "Choose category ID\n";
chomp($categorie = <STDIN>);
print "Choose the index of the first image you would like to download\n";
chomp($startPos = <STDIN>);
print "How many images?\n";
chomp($endingPos = <STDIN>);
print "Where shall I save the images?\n";
chomp($dir = <STDIN>);
-e $dir || die "The directory name $dir does not exist. Please check your spelling.\n";
# mkdir($dir, 0777) || die "Can't create the directory $dir.\n";
chdir($dir) || die "Can't change to the directory $dir.\n";
print "Starting to dump\n";
print "This may take several minutes…\n\n";
for($i=$startPos;$i<$startPos + $endingPos;$i++)
{
$preURL = "http://mobile.sciphone.net/full.php?id=$categorie&pos=$i";
$sourceCode = get($preURL);
$re1='(http)'; # Word 1
$re2='(:)'; # Any Single Character 1
$re3='(\\/)'; # Any Single Character 2
$re4='(\\/)'; # Any Single Character 3
$re5='(sciphone\\.net)'; # File Name 1
$re6='(\\/)'; # Any Single Character 4
$re7='(albums)'; # Word 2
$re8='(\\/)'; # Any Single Character 5
$re9='(userpics)'; # Word 3
$re10='(\\/)'; # Any Single Character 6
$re11='(\\d+)'; # Integer Number 1
$re12='(\\/)'; # Any Single Character 7
$re13='((?:[a-z][a-z\\.\\d\\-\\_]+)\\.(?:[a-z][a-z\\-]+))(?![\\w\\.])'; # Fully Qualified Domain Name 1
$re=$re1.$re2.$re3.$re4.$re5.$re6.$re7.$re8.$re9.$re10.$re11.$re12.$re13;
if ($sourceCode =~ m/$re/is)
{
$word1=$1;
$c1=$2;
$c2=$3;
$c3=$4;
$file1=$5;
$c4=$6;
$word2=$7;
$c5=$8;
$word3=$9;
$c6=$10;
$int1=$11;
$c7=$12;
$fqdn1=$13;
$imageURL = $word1.$c1.$c2.$c3.$file1.$c4.$word2.$c5.$word3.$c6.$int1.$c7.$fqdn1;
getstore($imageURL,$fqdn1);
print "[$i] $fqdn1 :finished\n";
}# Pattern matching
else
{
print "[$i] couldn't regex :failed!\n";
}# if pattern doesnt match
}# forLoop
sub printCategoryIDs
{
$preURL = "http://mobile.sciphone.net/index.php";
$sourceCode = get($preURL);
$txt = $sourceCode;
$re1='(<)'; # Any Single Character 1
$re2='(option)'; # Word 1
$re3='(\\s+)'; # White Space 1
$re4='(value)'; # Word 2
$re5='(=)'; # Any Single Character 2
$re6='(")'; # Any Single Character 3
$re7='(\\d+)'; # Integer Number 1
$re8='(")'; # Any Single Character 4
$re9='(>)'; # Any Single Character 5
$re10='((?:[a-z][a-z]+))'; # Word 3
$re11='(<\\/option>)'; # Tag 1
$re=$re1.$re2.$re3.$re4.$re5.$re6.$re7.$re8.$re9.$re10.$re11;
my %categories;
while ($txt =~ m/$re/isg)
{
$categories{$7} = $10;
}
$j = 0;
print " [ID] catergory [ID] catergory [ID] catergory\n";
print " ----------------------------------------------\n";
foreach $catID (sort keys %categories) {
if($j<2)
{
print " [$catID] ".$categories{$catID}." ";
$j++;
}else
{
print "\n [$catID] ".$categories{$catID}." ";
$j = 0;
}
}
print "\n\n";
}
Entschuldigt die hässlichen Regexe
![Wink](images/smilies/wink.png)
und die fehlende Kommentierung, wenn ich Zeit habe füge ich sie hinzu^^
- N0n3