Created
November 24, 2021 16:10
-
-
Save redraw/11b235dc1b0e984e8b15c22523d9f462 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
let more = true | |
let data = [] | |
let offset = 0 | |
while (more) { | |
console.log(`Fetch offset: ${offset}`) | |
var req = new XMLHttpRequest(); | |
req.open("GET", `https://www.pedidosya.com.ar/mobile/v2/users/myOrders?state=CONFIRMED&max=10&offset=${offset}&countryId=3`, false); | |
req.send(null) | |
let response = JSON.parse(req.responseText) | |
data = data.concat(response.data) | |
more = response.count > 0 | |
offset += 10 | |
} | |
let blob = new Blob([JSON.stringify(data)], {type: "application/json"}) | |
let elem = document.createElement("a") | |
elem.href = URL.createObjectURL(blob) | |
elem.download = "pedidosya.json" | |
elem.click() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment