-
-
Save ramkumar-kr/6ad76e9763aaa1f039e9e7e16ea2fc67 to your computer and use it in GitHub Desktop.
Download all pictures from a flickr set. This script will list links to pictures files. You can then bulk-download them using a browser extension (Download master for Chrome, DownThemAll for Firefox...)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<form> | |
<p> | |
<label for="api-key">Your Flickr API key:</label> | |
<input type="text" id="api-key" required="required"/> | |
</p> | |
<p> | |
<label for="set-id">Set ID:</label> | |
<input type="text" id="set-id" required="required"/> | |
</p> | |
<input type="submit" value="Get pictures from Flickr"/> | |
</form> | |
<ul></ul> | |
<script> | |
// http://www.flickr.com/services/api/explore/flickr.photosets.getPhotos | |
var size = "url_o"; //url_o for originals, url_m for medium | |
var printResults = function(data) { | |
var photos = data.photoset.photo; | |
for(var i=0; i < photos.length; i++){ | |
$("ul").append("<li><a href="+ photos[i].url_o +">"+ photos[i].title +"</a></li>") | |
} | |
// _.each(data.photoset.photo, function(photo) { | |
// $("ul").append("<li><a href='" + photo[size] + "'>" + photo.title + "</li>"); | |
// }); | |
}; | |
$("form").submit(function() { | |
var apiKey = $("#api-key").val(); | |
var setID = $("#set-id").val(); | |
if(!apiKey) {alert("No API Key");} | |
if(!setID) {alert("No Set ID");} | |
$.ajax({url: "https://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&format=json", data: {photoset_id: setID, extras:size, api_key:apiKey}, success: printResults, dataType: "jsonp", 'jsonp': 'jsoncallback' }); | |
return false; | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment