Skip to content

Instantly share code, notes, and snippets.

@sirdarthvader
Last active June 6, 2023 19:36
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save sirdarthvader/e049cc25020b7be9f65bb46c074ede12 to your computer and use it in GitHub Desktop.
Save sirdarthvader/e049cc25020b7be9f65bb46c074ede12 to your computer and use it in GitHub Desktop.
A minimal script to check overall spend till date on Zomato and Swiggy
/**
The below snippets will help you find total money spent on Zomato and Swiggy so far by any individual.
For Zomato:
Step 1: Go to Zomato.com,
Step 2: Go to "Profiles", click on "Order History"
Step 3: Scroll to the very bottom and click on "Load More", until the option disappears.
Step 4: Do a right click anywhere on the screen and click on "Inspect", in the inspector,
go to console copy and paste the below snippet and press enter.
*****IMPORTANT****
Make sure all the steps till step 3 is followed before doing the step 4.
*/
amount_node_list = document.querySelectorAll('.cost b');
amount_regex = /\d+.\d*/g;
total_amount = 0
for (let i = 0; i < amount_node_list.length; i++) {
current_amount = amount_node_list[i].innerHTML;
if (current_amount.match(amount_regex)) {
integer_amount = parseInt(current_amount.match(amount_regex)[0])
total_amount += parseInt(integer_amount);
}
}
console.log("Total amount spent on Zomato so far is INR ", total_amount);
/*
For Swiggy:
Step 1: Go to Swiggy.com,
Step 2: Click on your "Name" then click on "Orders".
Step 3: Scroll to the very bottom and click on "Show More Orders", until nothing new gets added.
Step 4: Do a right click anywhere on the screen and click on "Inspect", in the inspector,
go to console copy and paste the below snippet and press enter.
*****IMPORTANT****
Make sure all the steps till step 3 is followed before doing the step 4.
*/
amount_node_list = document.getElementsByClassName('_3Hghg');
amount_regex = /\d+.\d*/g;
total_amount = 0
for (let i = 0; i < amount_node_list.length; i++) {
current_amount = amount_node_list[i].innerHTML;
if (current_amount.match(amount_regex)) {
integer_amount = parseInt(current_amount.match(amount_regex)[0])
total_amount += integer_amount;
}
}
console.log("Total amount spent on Swiggy so far is INR ", total_amount);
@Nagaraju6242
Copy link

You can use this instead
Which uses api to retrieve data from swiggy and zomato

@vemahend
Copy link

vemahend commented Jun 6, 2023

I write the solution for zomato . Please refer and provide ur feedback
https://supportworksblog.wordpress.com/2023/06/06/how-to-check-total-spending-amount-on-zomato/

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