Set Up a Private Airfare Watchdog by Your Own

11 Nov

There are some public airfare watchdogs online. But we still have tons of reasons to set up a private one. For example, we do not want to share our email address, considering privacy and/or spam. Additionally, private watchdog has quicker response. And flexible customization is also a strong motivation. In this article, I will provide a solution to set up a simple but effective private airfare watchdog.

  1. Install Firefox. Yes, it is possible to write a program to crawl the airfare information. But the solution with Firefox is more portable and robust.  More importantly, it needs less labor hours.

  2. Install an extension for Firefox: iMacros. This is the core component to crawl the airfare information from different agents, such as flychina.com and onetravel.com. We need little programming background to write the script. Actually, the iMacros could record your activities on the webpage, and generate the script automatically.  As an example, we consider the open jaw trip from Los Angeles (LAX) to San Francisco (SFO) on 2013/11/11 and from Las Vegas (LAS) to Los Angeles (LAX) on 2013/12/12. The following script gets and stores the airfare quote page of flychina.com and onetravel.com to our specific directory E:/flight/temp/flychina and E:/flight/temp/onetravel respectively.

    Then we could run this script in loop. But beware of the quota of these sites. Lots of them have a daily maximum allowed search limitation. Once you reached it, the inquiry return nothing but warming message. As far as I know, flychina.com has such limitation. And if you search on onetravel.com every three or four minutes, you could do it for 24hour/day and 7days/week.

    If you have any programming background, you will find the script is easy to modify. You could improve it according your specific requirements.

  3. Install Python 2.7.X on your computer.

  4. Install pygooglevoice (http://code.google.com/p/pygooglevoice/). It is a Python package to use Google Voice. We use it to send SMS notification. But it is a little out of date, because Google changed the API interface. So we need fix the change before being able to use it. The fix solution could be found here (https://code.google.com/p/pygooglevoice/issues/detail?id=76&q=galx). If you do not need the SMS notification, you could just ignore this step. For ignoring the SMS notification, you need to comment 16th line in the source code with “#”.
  5. Copy the following code onto your computer, and give it the execution right if on *nix platform.

    The directory structure on my computer is like the following:

    Then you need to run the Python script, such as: “E:flights>c:Python27python.exe flight_monitor_gv.py temp”. The UI should be like this:
  6. Have a cup of coffee!

There is a big space to improve for this solution. The price and iteration parser should be designed as plug-in, so that we could add/remove/change them without modifying the main program.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please put your code into a <pre>YOUR CODE</pre> section. Thanks and Happy Coding!