Skip to content
Browse files

First script version, soviet way

  • Loading branch information...
1 parent 38f91c9 commit f83eed55f9585ca49d054dc6ca68ed8e7c72ec72 @hugocornejo committed Mar 3, 2011
Showing with 42 additions and 1 deletion.
  1. +8 −1 README.md
  2. +34 −0 locker-room.pl
View
9 README.md
@@ -1,3 +1,10 @@
Locker Room
===========
-A simple tool for downloading dribbble shots.
+A simple tool for downloading dribbble shots.
+
+To do
+-----
+* GUI
+* Include additional info with the files (author, link, etc.)
+* Check if a shot was previously downloaded
+* Keep real file extension
View
34 locker-room.pl
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+
+use strict;
+use WWW::Mechanize;
+use JSON -support_by_pp;
+
+my $user = 'simplebits'; # Your dribbble username, like 'bruce', 'frogandcode'...
+
+my $browser = WWW::Mechanize->new();
+
+my $pages = 2;
+my $page = 1;
+
+while ($pages >= $page) {
+ print "|"; # Every page
+
+ my $json_url = "http://api.dribbble.com/players/$user/shots/likes?page=$page&per_page=30";
+ $browser->get($json_url);
+ my $content = $browser->content();
+
+ my $json = new JSON;
+ my $json_text = $json->allow_nonref->utf8->relaxed->escape_slash->loose->allow_singlequote->allow_barekey->decode($content);
+
+ foreach my $shot(@{$json_text->{shots}}) {
+ print "."; # Every shot
+
+ system ("wget -q $shot->{image_url}");
+ }
+
+ $pages = $json_text->{pages};
+ $page = $json_text->{page} + 1;
+}
+
+

0 comments on commit f83eed5

Please sign in to comment.
Something went wrong with that request. Please try again.