check total spending amount on zomato

#zomato-spending-calculator


My wife warned me one day that although we don’t know the precise sum, but we have spent a huge amount on Zomato. In order to find out the precise amount, I signed onto the Zomato website and looked through the order history. I discovered that 29 pages, or roughly 290 orders, were coming up, and it would take me a long time to add up each one individually. I therefore decided to right my own script.

The below Steps will help you find total money spent on Zomato .

Step 1:

Go to https://www.zomato.com/

Step 2 :

Click on login and Enter your credentials.

Step 3:

Do a right click anywhere on the screen and click on “Inspect” and then click on Console, Refer below Image.

Step 4:

Click on Console. Refer Image Below

Copy and Paste Below script in console window.

function Get(yourUrl){
var Httpreq = new XMLHttpRequest(); // a new request
Httpreq.open("GET",yourUrl,false);
Httpreq.send();
return Httpreq.responseText;
}

var total_amount = 0
var obj1 = JSON.parse(Get("https://www.zomato.com/webroutes/user/orders?page=1"));
var pages = obj1.sections.SECTION_USER_ORDER_HISTORY.totalPages;
console.log("Calculating…..");
for (let index = 1; index < pages; index++) { var url = "https://www.zomato.com/webroutes/user/orders?page=" + index; obj = JSON.parse(Get(url)); if(obj.sections.SECTION_USER_ORDER_HISTORY.entities.length > 0)
{
var entites = obj.sections.SECTION_USER_ORDER_HISTORY.entities[0].entity_ids
amount_regex = /\d+.\d*/g;
for (let index = 0; index < entites.length; index++) {
total_amount += parseInt(obj.entities.ORDER[entites[index]].totalCost.match(amount_regex)[0])
}
}
}

console.log("Total amount spent on Zomato so far is INR ", total_amount);

And then wait for the results……

Leave a comment