Advertisement
Guest User

Retrieve peachyforum / imagevenue sets

a guest
Mar 24th, 2012
1,154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 3.26 KB | None | 0 0
  1. #!/usr/bin/perl
  2. # Retrieve all pics from
  3. # http://peachyforum.com/t/real-home-imagevenue-sets-pls-do-not-use-ie-for-viewing-273028.aspx
  4.  
  5. sub getPage {
  6.   my $url = shift;
  7.   my $content = `curl -- '$url' 2>/dev/null`;
  8.   return $content;
  9. }
  10.  
  11. sub extractImage {
  12.   my $url = shift;
  13.   my $content = getPage($url);
  14.   my $server = $url;
  15.   $server =~ m/(http:\/\/img[0-9]+\.imagevenue\.com)/;
  16.   $server = $1;
  17.   my @lines = split /\>/, $content;
  18.   for (my $l=0; $l<scalar(@lines); $l++) {
  19.     if (@lines[$l] =~ m/onLoad="scaleImg\(\);".+ SRC="(.+\.je?pg)".*alt=/) {
  20.       return "$server/$1";
  21.     }
  22.   }
  23.   return "notfound";
  24. }
  25.  
  26.  
  27.  
  28. my $currentPost = 0;
  29. my $baseDir = `pwd`;
  30. chomp($baseDir);
  31.  
  32. for (my $p=1; $p<36; $p++) {
  33.  
  34.   my $content = getPage("http://peachyforum.com/t/real-home-imagevenue-sets-pls-do-not-use-ie-for-viewing-273028/$p.aspx");
  35.   my @lines = split /\>/, $content;
  36.   my $currentPost = 0;
  37.   my $currentPhoto = 0;
  38.   mkdir($baseDir."/".$p);
  39.   for (my $l=0; $l<scalar(@lines); $l++) {
  40.  
  41.     if (@lines[$l] =~ m/ForumPostContentText/) {                                                                                              
  42.       $currentPost++;                                                                                                                        
  43.       $currentPhoto=0;                                                                                                                        
  44.       mkdir($baseDir."/".$p."/".$currentPost);                                                                                                
  45.       next;                                                                                                                                  
  46.     }                                                                                                                                        
  47.     if (@lines[$l] =~ m/a href="(http:.+\.imagevenue\.com\/img\.php\?image=.+)".*target="_blank"/) {                                          
  48.       my $imageUrl = extractImage($1);                                                                                                        
  49.       if ($imageUrl ne "notfound") {                                                                                                          
  50.         print "Image URL $imageUrl\n";                                                                                                        
  51.         `wget -c --output-document=$baseDir/$p/$currentPost/img_$currentPhoto.jpg '$imageUrl'`;                                              
  52.         $currentPhoto++;                                                                                                                      
  53.       }                                                                                                                                      
  54.     }                                                                                                                                        
  55.                                                                                                                                              
  56.   }                                                                                                                                          
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement