Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use Cwd;
- use LWP::Simple;
- $catalog = get('http://boards.4chan.org/g/catalog');
- @thread_ids = ($catalog =~ /"(\d+)":{"date":\d+,"r":\d+,"i":\d+,"lr":{"id":\d+,"date":\d+,"author":"[^"]+"},"author":"[^"]+","imgurl":"\d+","tn_w":\d+,"tn_h":\d+,"sub":"desktop thread"/gi);
- foreach (@thread_ids) {
- $id = $_;
- mkdir $id;
- chdir $id;
- $thread = get("http://boards.4chan.org/g/res/$id");
- @posts = ($thread =~ /<div class="fileText" id="[^ "]+">File: <a href="([^ "]+)" target="[^"]+">[^ <]+<\/a>/ig);
- foreach (@posts) {
- $url = $_;
- $url =~ s/\/\//http:\/\//g;
- ($filename) = ($url =~ /\/([^ \/]+)$/);
- $filename = cwd()."/$filename";
- unless (-e $filename) {
- print "Downloading to $filename\n";
- getstore($url, $filename);
- }
- }
- chdir '..';
- }
Add Comment
Please, Sign In to add comment