Skip to content

Instantly share code, notes, and snippets.

@realslimshanky
Last active September 9, 2021 22:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save realslimshanky/507faac7e67cc582c07a54bd0fa8375c to your computer and use it in GitHub Desktop.
Save realslimshanky/507faac7e67cc582c07a54bd0fa8375c to your computer and use it in GitHub Desktop.
Check total amount you spent on Zomato
/*
This is the script which can find cost spent on Zomato.com
Step 1: Visit Zomato.com, 'Profile' and click on 'Order History'
Step 2: Load all the orders by scrolling down and clicking on 'Load more' until it appears
Step 3: Run below script in Console (CTRL + SHIFT + I or CTRL + ALT + I) by copying/pasting after '>>' and press ENTER
*/
costs = $('.cost b').get()
cost_regex = /\d+.\d*/g
total_cost = 0
for (cost in costs) {
if (costs[cost].innerHTML.match(cost_regex)) {
cost_in_int = parseInt(costs[cost].innerHTML.match(cost_regex)[0])
total_cost += cost_in_int
}
}
console.log('Total ', total_cost, ' spent on Zomato!')
@mahababa
Copy link

mahababa commented Sep 9, 2021

Any revision to this current script? The updated website doesnt support the script.

@realslimshanky
Copy link
Author

@mahababa New site uses pagination on Order History and it's better to write a custom crawler using say Scrapy.

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