Extract Buyee package information to a table

· Further Notes…

#bookmarklet #Buyee #JavaScript #jq #jQuery #Mercari #programming #Yahoo Japan Auctions

I use Buyee to purchase junk treasures from Japan, primarily from Mercari and Yahoo Japan Auctions, and I have found the cheapest way to ship things back to Australia is to use their consolidation service to group multiple purchases into the one shipment to Australia. In the past I have manually looked at each package, opened the "Shipping Information" accordion and made notes on a bit of paper, trying to come up with the optimum combinations of purchases to consolidate to the one package for shipping. Finally I decided to make my life a bit easier and I have whipped up a little JavaScript bookmarklet to extract this info and put it in a table at the top of the page, so I can easily cut and paste it out into Excel to play with.

My jQuery was a bit rusty and it's still a little rough around the edges, but it make accessing this info a lot easier and saves me a bunch of time. Something I discovered is that if you have more than a page of packages (20) there seems to be a Buyee bug where it does not load the dimensions for the extra packages along with the other details. Therefore you need to change the display order and then deal with any duplicates, if you have more than 40 packages then I think you're stuck.

Because I can't embed it on this blog you can get it here.

And a note on encoding, it seems browsers are pretty forgiving, my initial attempt for instance I manually changed all the quotes into " so it would correctly fit in the href attribute of the a tag. Thinking later I realised it is really a URL, so I think the best way is to URL encode it. Because it has both single and double quotes I was strggling with how to get it into a string to call encodeURI() with, some searching turned up a gist, and in particular this comment by @marfillaster on using jq to URI encode a string which I really liked. Using this I could just pipe my source file into jq and not have to query about getting it into a string.