Skip to content

Instantly share code, notes, and snippets.

@vyashole
Last active December 12, 2023 14:21
Show Gist options
  • Save vyashole/8dbbd909943d96486857dfd5bb539ba2 to your computer and use it in GitHub Desktop.
Save vyashole/8dbbd909943d96486857dfd5bb539ba2 to your computer and use it in GitHub Desktop.
Gluttony - Zomato Order History Export
var results = []
$('.order-history-snippet').each(function() {
from = $(this).find('.col-l-16 .w100 .mtop0 .ui .item .content .header .left').text().trim()
status = $(this).find('.col-l-16 .w100 .mtop0 .ui .item .right b').text().trim()
orderNumber = $(this).find('.order-number').text().split(':')[1].trim()
cost = $(this).find('.cost b').text().trim().replace('₹', '') // comment the replace part if you want the ₹ symbol in the sheet.
//LibreOffice was having a hard time applying formulas to values with the symbol
date = $(this).find('.ui.basic.label').text().trim()
results.push({
date, orderNumber, from, cost, status
})
});
var fields = Object.keys(results[0])
var csv = results.map(function(row){
return fields.map(function(fieldName){
return JSON.stringify(row[fieldName])
}).join(',')
})
csv.unshift(fields.join(','))
text = csv.join('\r\n')
console.log(text)
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', 'export.csv');
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);

Gluttony

Zomato Order History Scraper

Usage

  • Log in to Zomato in your browser
  • Go to order hostory page
  • Click Load More as many times as you want. You can go back as far as you want. ( maybe I'll add this functionality in the script later)
  • Right click any item > Inspect
  • paste the contents of gluttony.js into the console and run it
  • You'll see a csv in your downloads when it's done.
@sakethbolla
Copy link

Let me work on it and fix this thing.

So does it work now

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