Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use LWP::Simple;
- die "Usage: $0 [tags] [directory for pics]" if @ARGV != 2;
- my $tags = shift @ARGV;
- my $path = shift @ARGV;
- mkdir $path unless -d $path;
- ########################
- my $maxcount;
- my $content = get("http://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=0&tags=$tags");
- $content =~ /<posts count="(\d+)"/;
- $maxcount = $1;
- my $page = 0;
- for(my $pid = 0; $pid*100 <= $maxcount; $pid++) {
- ++$page;
- # $tags =~ s/\s| /\+/;
- my $content = get("http://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=100&tags=$tags&pid=$pid");
- print "----page $page loaded\n";
- while($content =~ m!file_url="http://(.*?)\.gelbooru.com/images/(\d+)/(.*?\.(jpe?g|png|gif))"!gi) {
- getstore("http://$1.gelbooru.com//images/$2/$3", $path.$3);
- print $3." ---------loading\n";
- }
- print "----images from $page page loaded\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement