I *heart* hacking with fellow librarians
Jessamyn IM’d me this morning with a tech question, and it turned into a wonderful hack session.
Jessamyn wanted to know if I knew how to edit the Jon Udell bookmarklet to hit WorldCat directly, without going through a library subscription. I figured it must be able to, since WorldCat has released around 2 million of it’s records for search by Yahoo! and Google.
We decided to try this through Google, and the first breakthrough was working out the actual Google query. Using the search string “
http://www.google.com/search?q=1574411543+site%3Aworldcatlibraries.org
But how do we skip this extra step, and get straight to WorldCat without the Google results? Jessamyn figured out that it was the “I Feel Lucky” feature that does it for you. So we reformatted the URL to this, continuing with the Revolting Librarians Redux example above:
http://www.google.com/search?q=1574411543+site%3Aworldcatlibraries.org&btnI=I%27m+Feeling+Lucky
The only thing left was making the bookmarklet work with WorldCat. I didn’t think it would be difficult, since the scrape for the ISBN in the javascript would stay the same, only the URL for the OPAC, in this case our WorldCat/Google URL, would change. Fuss as we might, we couldn’t get it to lookup a book from Amazon. I thought that maybe it was having a problem with the “isbn” variable in the middle of the URL call, so we toyed with the URL until it brought us to the correct WorldCat record with the ISBN at the end, and popped the variable in at the end, since the other bookmarklet URLs had the “isbn” variable at the end. We ended up with:
javascript:var%20re=/([\/-]|is[bs]n=)(\d{7,9}[\dX])/i;if(re.test(location.href)==true){var%20isbn=RegExp.$2;void(win=window.open(’http://www.google.com/search?btnI=I%27m+Feeling+Lucky&q=site:worldcatlibraries.org+’+isbn,’LibraryLookup’,’scrollbars=1,resizable=1,location=1,width=575,height=500′))}
My current theory is that the script doesn’t like the “+” inside the URL single quote, as opposed to the “+” as the connector (see bolded bit above). But that’s just a theory. I tried an “&” in its place, but the URL wouldn’t work that way.
Jessamyn, having more librarian street cred than myself ;), is sending an email to Jon Udell to see if he can tell us where we went wrong.
Even if someone else has figured this out, the thought and collaboration process on this was *awesome*. And if nothing else, people can use this information to create their own WorldCat search links to web sites and blog posts, using the ISBN, title, or author. Hopefully we’ll get that bookmarklet working with some help. If you’ve got any tips, send me email and let me know.
Tags: technology




