Links

pmuellr is Patrick Mueller

other pmuellr thangs: home page, twitter, flickr, github

Friday, March 23, 2007

Wake County Library Lookup

In my previous post regarding using libraries, I mentioned using Josh Staiger's Wake County Library Lookup Greasemonkey script, which annotates Amazon.com pages with links to the library, if the library has the book in it's collection.

What I neglected to mention is that I have been having problems with the script for the past few weeks. One problem was that a number of Amazon pages no longer contained the library links at all; I think this is due to Amazon's new URL scheme. The ISBN was being pulled from the URL, and it's not always there anymore, or in a different place. The search for the ISBN has been expanded so that now more books will be candidates for library lookup.

The other problem was that the page layout of the Amazon pages changed, such that the links Josh was adding were no longer appearing. Dark XPath and DOM hackery. ~shiver~ I fixed that by not placing the library information in-line with the page the way Josh was doing, but placing it at the top of the page. A bit icky, but it's pretty much guaranteed that the links will show up now; the script is not currently dependent on the shape of the HTML on the page.

I talked to Josh about the issues earlier this week, and he mentioned he hasn't been keeping a close eye on the script, because he doesn't actually live in Wake County anymore. Although he has been making some updates, as recent as this January. What a trooper!

So it only makes sense at this point to fork and maintain a new version of the code, since Josh really doesn't have a reason to do this anymore. My version of the script is here. It's highly likely that I won't be updating it, till Amazon or Wake County make enough changes to their pages to break the script again. Which is pretty much guaranteed. The perils of screen scraping. But I'm certainly open for any thoughts on the functionality.

Thanks for putting the time into this Josh!

2 comments:

Miller Family said...

Josh referred me to your lookup. Yours works better than his (shows up), but appears to be broken. Do you know if anyone else is working on these? Are you still in RDU area?
I really miss this functionality. :-(

Thanks!

Patrick Mueller said...

I don't actively use FireFox anymore, so don't really have any personal reason to keep this updated. I suspect once Chrome has a reasonable story for extensions, I'll do one for it. Sorry.