Alt text

Since I started working freelance, I’ve been planning to get few of my projects that I had to shelve during my fulltime tenure, off the ground. So this month, while my part-time slot was opening up, I started working on them again.

One of the project that I’m most interested in was a price comparison for all of Apple products in different country against the latest currency rate. While I’m buying my MacBook and iPhone, the ringgit was down. Since I was traveling on monthly basis, I’ve been wondering if I can get them anywhere cheaper in the region.

It’s a simple data, but I couldn’t find anywhere helpful except to manually go to each Apple Online Store. True to the way of developer, there’s only one way to solve this issue: build them.

The Process

There’s no reliable free API available for it, so I started poking around the Apple product page. Luckily, I found the pages use metadata for the prices, where you can retrieve them using Google Structured Data Testing Tool. I believe it was indexed by Google Shopping so it should reflect accurate data.

Using the magic of Nokogiri and a belief that Apple rarely redesign their whole product page, I went forth and wrote a highly-customized scraper that goes to each country Online Store. It was a lot of work but seeing that database gets populated without a single hitch was well worth it.

Alt text

It’s a bit crude to display just the price without any context, not to mention the treachery of using Bootstrap default styling. Sorry designers.

Alt text

So I added the percentage difference between, current exchange rate, as well as group countries by region, since it make more sense to compare nearby countries you actually willing to travel in order to buy them.

Alt text

While we’re at it, why not add local prices, and color-coded value for easier scanning. Also, currency exchange movement won’t hurt anyone (except those citizens with devalued currencies).

Alt text

To sum up the data, I put top three countries to buy Apple products in home page. Not all that surprising for the best countries, but it is safe to say that EMEA countries generally pay more.

Alt text

Finishing Up

I added latest price changes for occasional price update, which also happened while I’m building it. Based on early feedbacks, there’s also VAT refund that I can include in the table.

The whole dev took a little more than 2 weeks, and some sleepless nights. So here’s the result, if you’d like to check them out:

Categorized under

Science & Tech