Sometimes those of us who evangelize the web as a platform get asked by people to show what all this “new fangled stuff” an actually do. Spending so much time looking at the minutiae of software/cloud computing/the web it’s sometimes hard to come up with a quick answer. Last week Nat Torkington posted a link to a story that encapsulates what we’re trying to achieve here in one easy bite – it’s not a particularly “useful” example, but it’s an example of integrations and the power of the API.

Anyway, Paul Hunkin is a PhD student at the University of Waikato who obviously has a little too much time on his hands. Seeing that New Zealand’s largest auction website,TradeMe, recently released an API, Paul decided to work some mashup magic. So what did he do? Well inspired by the XKCD cartoon below, Paul decided to automate the purchase of finely selected items on a daily basis and post the results of his “experiment” to Twitter. He’d already made similar experiments using scraping – and created this neat little site to create automated feeds for particular auction searches.

alt

It’s pretty interesting how Paul made this all work. From his own post:

  • It’s using Python and python-oauth2. For anyone looking to do TM stuff with python, the code examples on that page basically just worked.
  • It runs every day at 8pm (although it was earlier today because I was testing it)
  • It gains $1 every day, and has a 1 in 3 chance of buying an item on any particular day. This means that it will save up money to buy some (slightly) more expensive items.

The method it uses to select items:

  • It has a bunch of top-level categories it looks in.
  • For each of these categories, it searches for the term “Free shipping”, specifying both pay-now and buy-now, sorting by newest listings, with a maximum of 100 items returned per category.
  • For each of these items, it filters on buy-now price. It tries to spend at least 50% of its savings.
  • For each of the surviving items, it looks up the individual auction details to find its shipping information so it can filter on free shipping. Despite searching for the term ‘free shipping’ to start, only a small number of items have this.
  • At this point I have a list of items that match the price requirements, and can be bought with a credit card buy-now.
  • I then sort this list by ‘rarity’ – doing a search for the item title, and finding the item that returns the least results. As the objective here is to buy strange and esoteric things, rarity is preferred.
  • Finally I buy the rarest item and subtract its cost from the bots savings.

Like I said, it’s not a particularly USEFUL example of the power of the API, but it’s a very cool one… Or maybe I just say that because I’m  geek…

Enhanced by Zemanta
Ben Kepes

Ben Kepes is a technology evangelist, an investor, a commentator and a business adviser. Ben covers the convergence of technology, mobile, ubiquity and agility, all enabled by the Cloud. His areas of interest extend to enterprise software, software integration, financial/accounting software, platforms and infrastructure as well as articulating technology simply for everyday users.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.