Advertisement
ricbaral

Find out how much you've spent on apps in the Play Store

Dec 12th, 2013
10,914
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Find out how much you've spent on apps in the Google Play Store
  2. *
  3. * INSTRUCTIONS - read this first!
  4. *
  5. * It Only works for a single currency, because it adds up the number values.
  6. *
  7. * 1. Go to https://play.google.com/store/account
  8. * 2. Scroll all the way to the bottom of the "my orders" page in the Play Store. Click every "show more" button and keep scrolling. It loads the content dynamically while scrolling and gets stuck sometimes. Try scrolling up and down a few times, that triggers a reload of the other items.
  9. * 3. Your very first order/install should now be visible at the bottom of the table.
  10. * 4. Paste the code in your browser's developer console. In Chrome for Mac press Option+Command+J. Another way is: right click > inspect element > console tab > paste full code
  11. * 5. Press enter and see your result.
  12. */
  13.  
  14. var totalAmount = 0.0
  15. $('.list-table').find('tr').each(function() {
  16.     var isCancelled = $(this).find('.purchase-status').find('div').hasClass('history-canceled')
  17.     var isApp = $(this).hasClass('app')
  18.     if (isApp && !isCancelled) {
  19.         var text = $(this).find('.purchase-price').text()
  20.         text = text.replace(",",".") // European-style conversion
  21.         text = text.replace(":",".") // Swedish krona conversion
  22.         appPrice = parseFloat(Number(text.replace(/[^0-9\.]+/g,"")))
  23.         if (!isNaN(appPrice))
  24.             totalAmount = totalAmount + appPrice
  25.     }
  26. })
  27. alert('Total amount spent on apps: ' + totalAmount.toFixed(2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement