Created
September 16, 2016 01:05
-
-
Save Penderis/6f8e3636d1e37d9e12925959dc3f6bc7 to your computer and use it in GitHub Desktop.
Download facebook album when in full view
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
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instructions
only tested in chrome
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.