Created
December 22, 2018 02:02
-
-
Save Tackyou/38f22ef5c0d5c212bc211a15458d79a5 to your computer and use it in GitHub Desktop.
Downloads all invoices
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(){ console.log("Adiro Invoice Downloader"); $.getScript('https://cdnjs.cloudflare.com/ajax/libs/downloadjs/1.4.8/download.min.js'); console.log("Please wait 8 seconds..."); setTimeout(function(){$('body > div.mdl-grid.content > div.mdl-cell.mdl-cell--8-col > table.mdl-data-table.table.mdl-shadow--2dp.mdl-cell--hide-tablet.mdl-cell--hide-phone > tbody > tr').each(function(i){ var dl = $(this).find('td > a'); var uri = "https://publisher.adiro.de"+dl.attr('href'); var filename = "adiro_"+dl.text().slice(0, -4)+"_"+$(this).find('td:nth-child(2)').text().trim()+".pdf"; setTimeout(function(){ console.log('Downloading #'+(i+1)+' '+filename); var x=new XMLHttpRequest(); x.open("GET", uri, true); x.responseType="blob"; x.onload=function(e){download(e.target.response, filename, "application/pdf");}; x.send(); }, i*3000); });}, 5000); })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment