Dial to find the price of a book

Dial  +91-40-44556944(pin 8586), enter ISBN and know the cost of a book on flipkart.

Scenario
You are in a book store, looking at an interesting it. Before buying it, you would like to peek at its price online and see if you can order it online for a better deal. You have a mobile phone, but no internet on it.

Use Case
Dial a number (+91-40-44556944 and pin 8586), enter the ISBN number of the book that you are holding and instantly get the price of the book.

APIs used
This is the scenario and the solution that I hacked together, during the weekend. Hacker News carried a story about kookoo.in some days ago. The phone API looked interesting and I decided to give it a try.
KooKoo.in has Java APIs that can be used to create web services that feed into the phone API they provide. I fired up an instance of Google App Engine at http://flipring.appspot.com/price.

Technical WorkFlow
  1. When the user dials the number and the PIN, the web service is called the first time and it plays a message telling the user to enter the ISBN number. A session variable stores the state.
  2. When the user enters the ISBN number, the web service is called again, something like http://flipring.appspot.com/price?data=0333933427. This time, the value in the session variable indicates that the user has entered the ISBN number and its price is required. 
  3. A crawler kicks in an gets the search site from flipkart.com with the ISBN. The product page is obtained and a naive search is done to extract the price, discount, book name and author. 
  4. This data is played back and the session variable is set to initial state again. 
The code for this servlet is available here. The entire application was put together in under an hour and the crawler code is brittle.

Next Steps
As the next steps, I am looking at
  • Improve the crawler, get prices from more sites to return the cheapest price
  • Host the code as a project on github or google code.
This is my first DTMF application and please do write to me if you have feedback. Watch out this space for updates.