Advertisement
Guest User

Just-eat Scraper

a guest
Jul 17th, 2023
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Old ver on Reddit didn't work so made a new one for those interested.
  2.  
  3. // Go to
  4. // https://just-eat.co.uk/order-history
  5. // Log in and go to 'My Orders'
  6. // Click 'Load More' until the button disappears.
  7. // Right click BG and Inspect Element
  8. // Open console and paste below script, click enter, feel like crying.
  9.  
  10. function getPrice(summary) {
  11.     let start = summary.indexOf("£")
  12.     let priceText = summary.substr(start + 1, 6);
  13.     let price = parseFloat(priceText);
  14.  
  15.     console.log(price);
  16.     return price;
  17. }
  18.  
  19. let sum = 0;
  20. for (let result of document.getElementsByClassName("c-order-summary")) {
  21.     let summary = result.innerText;
  22.     let price = getPrice(summary);
  23.     sum += price;
  24. }
  25.  
  26. let totalString = new Intl.NumberFormat("en-gb", { style: "currency", currency: "GBP" }).format(sum);
  27. console.log(`Total: ${totalString}`);
  28.  
  29. // credit to Zq-hx for script.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement