Skip to content

Instantly share code, notes, and snippets.

@melvinvarkey
Created March 29, 2020 18:30
Show Gist options
  • Save melvinvarkey/2aa43f25bd504ba41ed0e9ae357050cc to your computer and use it in GitHub Desktop.
Save melvinvarkey/2aa43f25bd504ba41ed0e9ae357050cc to your computer and use it in GitHub Desktop.
function download(url, filename) {
fetch(url).then(function(t) {
return t.blob().then((b)=>{
var a = document.createElement("a");
a.href = URL.createObjectURL(b);
a.setAttribute("download", filename);
a.click();
}
);
});
}
async function task(i) {
await timer(1000);
console.log(`Task ${i} done!`);
}
async function main() {
for(let i = 0; i <= 960; i++) {
let r = /\d+/;
let textContent = document.querySelectorAll('._2uT6l')[i].innerText;
swiggyID = textContent.match(r);
download("https://www.swiggy.com/invoice/download/"+swiggyID);
await task(i);
}
}
main();
function timer(ms) { return new Promise(res => setTimeout(res, ms)); }
@melvinvarkey
Copy link
Author

  1. Log in to swiggy.com
  2. Run the above script in chrome console.

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