-
-
Save wutupake/7026700 to your computer and use it in GitHub Desktop.
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> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Facebook batch photo download</title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> | |
<h1>Facebook batch photo download</h1> | |
<p class="progress">Listing photos...</p> | |
<p class="success"> | |
Done. | |
Now copy all the entries form the console on a list.txt file and use <a href="http://www.gnu.org/software/wget/" target="_blank">wget</a> to download them: | |
<code>wget -i list.txt</code> | |
</p> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script> | |
var profile_id = ''; // Set here the target facebook user id | |
var limit = 400; // Set a high limit or facebook will retrieve just the first 25 | |
var getAlbumImages = function() { | |
$(".progress").show(); | |
$(".success").hide(); | |
$.get('https://graph.facebook.com/' + profile_id + '?fields=albums.fields(photos.limit(' + limit + ').fields(images),name)', function(response){ | |
if (!!response.albums && !!response.albums.data) { | |
for (var i = 0; i < response.albums.data.length; i++) { | |
var album = response.albums.data[i]; | |
if (!!album.name && !!album.id && !!album.photos && !!album.photos.data) { | |
console.log("*** starting retrieval images for album " + album.name + " (" + album.photos.data.length + " items) ***") | |
for (var j = 0; j < album.photos.data.length; j++) { | |
var data = album.photos.data[j]; | |
if (!!data.images) { | |
var image = data.images[0]; | |
if (!!image.source) { | |
var imageurl = image.source; | |
console.log(imageurl); | |
} | |
} | |
} | |
console.log("*** finished retrieval images for album " + album.name + " (" + album.photos.data.length + " items) ***"); | |
} | |
} | |
$(".progress").hide(); | |
$(".success").show(); | |
} | |
}, 'json'); | |
}; | |
getAlbumImages(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment