Skip to content

Instantly share code, notes, and snippets.

@Penderis
Created September 16, 2016 01:05
Show Gist options
  • Save Penderis/6f8e3636d1e37d9e12925959dc3f6bc7 to your computer and use it in GitHub Desktop.
Save Penderis/6f8e3636d1e37d9e12925959dc3f6bc7 to your computer and use it in GitHub Desktop.
Download facebook album when in full view
function gettingNext(){
var getNext = document.getElementsByClassName('snowliftPager next');
//console.log(getNext);
return getNext;
}
function newOptions(){
var options = document.querySelector('a[data-action-type="open_options_flyout"');
// console.log(options);
return options;
}
function getDownload(){
var counter = 0;
var downbutton = document.querySelectorAll('a[data-action-type="download_photo"]');
counter = downbutton.length - 1;
//console.log(downbutton);
return downbutton[counter];
}
function goToDownload() {
//object counter , everyloop.
//var getting = document.getElementsByClassName('snowliftPager next');
getting = gettingNext();
getting[0].click();
openOptions = newOptions();
openOptions.click();
var downloadTrigger = getDownload();
downloadTrigger.click();
openOptions.click();
}
(function theLoop (i) {
setTimeout(function () {
console.log("loop "+ i);
goToDownload();
if (--i) { // If i > 0, keep going
theLoop(i); // Call the loop again, and pass it the current value of i
}
}, 5000);
})(10);
@Penderis
Copy link
Author

Penderis commented Sep 16, 2016

Instructions

only tested in chrome

  1. Set default download location to not prompt and folder to where you want files to be saved
  2. Open album , and select image to go into large display view
  3. For safety click the options button then just hover over the popup menu over the download link
  4. copy script into console
  5. change "10" at end of script to the amount of photos +/- 10 or so since the gallery loops around to be sure you get it all
  6. leave everything else alone and run script.

To Note

script uses setTimeout which effectively waits 5sec , for safety , since unable to check if download completed.
could delay time when download starts to be sure image even loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment