Created
December 28, 2021 18:06
-
-
Save aakashb95/fd131fd83ac6f6740c5ecb0d28df7ab9 to your computer and use it in GitHub Desktop.
swiggy-all-orders
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
order_array=[] | |
order_id='' | |
page = 1 | |
try { | |
while(true){ | |
var xmlHttp = new XMLHttpRequest() | |
xmlHttp.open( "GET", "https://www.swiggy.com/dapi/order/all?order_id="+order_id, false ) | |
xmlHttp.send( null ) | |
resText=xmlHttp.responseText | |
var resJSON = JSON.parse(resText) | |
order_id=resJSON.data.orders[resJSON.data.orders.length-1].order_id | |
order_array=order_array.concat(resJSON.data.orders) | |
console.log("On page: "+page+" with last order id: "+order_id) | |
page++ | |
} | |
} | |
catch(err) { | |
console.log(order_array) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
taken from https://towardsdatascience.com/midnight-hack-episode-1-visualizing-my-swiggy-order-history-f1cce25cbff6