Last active
June 6, 2023 19:36
-
-
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
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
/** | |
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); |
Any revision to this current script? The updated website doesnt support the script.
@mahababa you have to make sure all the orders are loaded by clicking on the show more orders buttion for this to work just in case you haven't done that, the script is fine it worked for me
Update the code for zomato, just work around - update-1
Please update the code for Zomato.
You can use this instead
Which uses api to retrieve data from swiggy and zomato
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
hi the website is now updated and it shows orders page wise like 1,2,3,4,5 not load more