Breakdown of the crosslist script

2010 February 4
by Karen

So as I previously mentioned I created a script that crosslists print books and ebooks in Serial Solutions and our library catalog. The mechanics behind this script are pretty simple.

  1. Screenscrape the ISBN from the web page using JQuery
  2. Send the ISBN to a PHP page which queries the WorldCat Search API for that ISBN and holdings at the UH Library or Send ISBN to PHP page which queries Serial Solutions to see if UH has electronic holdings for that item
  3. PHP script returns a JSON object with the OCLC Number
  4. Use JQuery to Parse the JSON retrieve the OCLC Number and build a link to be inserted into the desired spot on the web page.

The steps are the same for both Serial Solutions and the catalog. The big differences in the code? The code which grabs the ISBN and the code which inserts the link in the right place. This is because the UIs are different so it take different JQuery code to get the ISBN and then insert the link.

Here is the Javascript which works to insert crosslinking into an Innovative catalog and Serial Solutions. I’ve commented it so you can see which part corresponds to each.

In addition, to make this work you have to have the PHP scripts on your server. There is one for WorldCat and one for Serial Solutions. I created these to solve the cross server scripting problem and get the data into JSON format which is easier to manipulate as well. I’ve made these available for download as well as examples (Serial Solutions / WorldCat). It isn’t as abstracted as much as I like. For example, if I had the time I would have coded it so that the PHP builds the link back to the catalog based on the OCLC Symbol submitted. I can do this if I tap the OCLC Registry but I was in a rush and didn’t take the time to code it this way on the first round.

This post is a hold over from before I started working for OCLC which I didn’t get published until now. I’m posting it here so that folks who saw the original content can follow-up. Future posts on OCLC Web Services will be at the OCLC DevNet Blog.

No comments yet

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS