Last active
September 9, 2021 22:24
-
-
Save realslimshanky/507faac7e67cc582c07a54bd0fa8375c to your computer and use it in GitHub Desktop.
Check total amount you spent on Zomato
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
/* | |
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 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
Any revision to this current script? The updated website doesnt support the script.