Created
March 29, 2020 18:30
-
-
Save melvinvarkey/2aa43f25bd504ba41ed0e9ae357050cc to your computer and use it in GitHub Desktop.
This file contains 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 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)); } |
Author
melvinvarkey
commented
Mar 29, 2020
- Log in to swiggy.com
- 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