Skip to content

Instantly share code, notes, and snippets.

@mixu
Last active March 31, 2018 00:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mixu/3daa41bd5b0fa4ded2b26811aa53b503 to your computer and use it in GitHub Desktop.
Save mixu/3daa41bd5b0fa4ded2b26811aa53b503 to your computer and use it in GitHub Desktop.
Facebook album downloader
var images = [];
function getPhoto() {
var img = document.querySelector('.spotlight');
console.log(images.length, img.src);
var hasImage = images.indexOf(img.src) !== -1
if (!hasImage) {
images.push(img.src);
var currentSrc = img.src;
document.querySelector('.snowliftPager.next').click();
var interval = setInterval(function() {
var loading = document.querySelector('.spotlight');
if (loading.src !== currentSrc && loading.complete) {
clearInterval(interval);
getPhoto();
}
}, 100);
} else {
console.log('all done');
window.wget = images.map(function(image) {
return 'wget --no-check-certificate "' + image + '"';
});
window.wget.map(function(line) {console.log(line); });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment