Add book price comparison to Amazon

I wrote a small Greasemonkey-Script, that adds links to the most famous German book price comparisons to the Amazon website.

Greasemonkey is a Firefox-Addon providing the possibility to customize web-pages using Javascript and DOM. The script I wrote is based on the Amazon Linky script and performs the following tasks on every page at amazon (tested on amazon.de, but should work with other TLDs as well):

  1. Parse the page and try to find the ISBN number
  2. Abort processing if none was found. That’s the case if you are not looking at product details but e.g. search results or the product shown is not a book.
  3. Search for the tag at the position where links should be added (under the “used & new” link)
  4. Create the links to the search engines
  5. Insert the new tags into the page

Most of the steps should be quite self-explanatory when looking at the script’s source code. The most difficult part is setting up the URLs to the search engines. I got them by visiting the book price comparison and performing a search for the ISBN number of an arbitrary book. Then on the result page, I had a closer look at the address bar. If you’re lucky then the ISBN number entered appears somewhere in the URL. Just try to search for another book by exchanging the ISBN in the URL with another one. If that works (and it does most of the time), you’re ready to go.

Edit the script’s source and use one of the already existing engines as template. Paste your URL as href-attribute in it and adjust it to read the ISBN number from the variable “isbn”.

amazon_buchpreis.user.js

Share and Enjoy:
  • Facebook
  • Twitter
  • del.icio.us
  • Diigo
  • Google Bookmarks
  • Digg
  • Reddit
  • StumbleUpon
  • MySpace
  • MisterWong
  • DZone
  • Slashdot
  • PDF
  • Print
  • email