Tracking the Wii on Amazon

Getting your hands on a Nintendo Wii isn't the easiest thing. Some people camped out, but web geeks like Glen Murphy camped out using greasemonkey. His script works great except I'd recommend changing:

unsafeWindow.location.href =
    "file:///G:/Music/Ministry%20Of%20Sound%20-"
    + "%20The%20Annual%202007/CD1/09%20-%20Benassi"
    + "%20Bros%20-%20Feel%20Alive.mp3";

which navigates away from amazon when the wii becomes available to

var iframe = document.createElement('iframe');
     iframe.src = 'file:///home/jesse/loud.mp3';
     document.body.appendChild( iframe );

So the music will still start, but you don't have to figure out how to turn off greasemonkey _and_ complete the purchase at 3am.

I've also been playing with a server based amazon wii tracker. Right now it is very simplistic. Adding a graphical history would make it interesting... hmm... view source on the page to see the client side, for the server side I used ruby/amazon.

simple 3 box interface showing the price and available of the wii on amazon

The server side component is rather simple:

require 'amazon/search'

include Amazon::Search  # don't want to have to fully qualify identifiers

asins = [['B0009VXBAQ', 'Nintendo Wii'],
         ['B000IMWK2G', 'Wii Remote Controller'],
         ['B000IMYKQ0', 'Wii Nunchuck Controller ']]

DEV_TOKEN     = '' # your development token
while 1:
  request  = Request.new(DEV_TOKEN)
  request.cache = false
  response = request.asin_search(asins.collect {|x| x.first }, Amazon::Search::HEAVY, 1, 'All')

  open('data.js', 'w') do |f|
    f.puts "var data=["
    response.products.each do |prod|
      f.puts "  {"
      f.puts "    asin: '#{prod.asin}',"
      f.puts "    third_party_new_count: #{prod.third_party_new_count},"
      f.puts "    third_party_new_price: '#{prod.third_party_new_price}',"
      f.puts "    sales_rank: #{prod.sales_rank},"
      f.puts "    total_customer_reviews: #{prod.total_customer_reviews},"
      if prod.availability != "This item is currently not available."
        f.puts "    availability: '#{prod.availability}',"
        open( 'log.txt', 'a' ) { |l| l.puts "#{prod.asin}|#{prod.availability}|#{Time.now}" }
      end
      f.puts "  },"
    end
    f.puts "]"
  end
  sleep 8
end

Hopefully this will help someone get a wii.


Share/Save/Bookmark

Published

Sat, 09 Dec 2006

View Comments


Want more like this?

Subscribe via RSS
or by email:

New Relic