OCLC Developer Network

Schema.org markup extractor

What it does

This bookmarklet extracts Schema.org markup from a web page and allows a user to chose to send that markup to Goodreads or to a demonstration Patron Driven Acquisitions form. Users can choose to put a particular book on their Goodreads To Read, Read or Currently Reading shelf or request the items via a prototype Patron Driven Acquisition web form. The PDA webform is designed to receive an OpenURL and automatically fill out the form based on this data. The user can then enter their information such as name and email address.

How it works

The basic bookmarklet is based on Javascript and the JQuery library. It uses JQuery selectors to extract the basic metadata from the page including title, author, publisher, publication date, ISBN, and OCLC number. Once it has this metadata it uses it to build requests to other services. One service it communicates with this Goodreads, a social reading site. Unfortunately, Goodreads doesn't API doesn't support OAuth2 or CORS so the bookmarklet cannot interact with it directly. Instead it sends the data to an intermediary PHP page which helps make the connection between the the data and Goodreads. The PHP page walks the user through the OAuth1 workflow so that they are logged in and allows the application to act on their behalf and add the item to their Goodreads library.

The other option that the bookmarklet provides is to allow the user to send the metadata gathered by the bookmarklet off in the form of an OpenURL. It is currently designed to send an OpenURL to an prototype Patron Driven Acquisitions form which is designed to automatically fill the form fields based on the metadata in the OpenURL. However, the OpenURL endpoint could easily be changed to point another service capable of receiving OpenURLs - such as a local OpenURL resolver or ILLiad OpenURL endpoint.

Installing the code

The bookmarklet code (Javascript and server side helpers) is available for download from the Developer Network Subversion respository.

Libraries who want to make a version of the bookmarklet available with need to host the helper code and alter the bookmarklet code to point to the urls for their helper pages. This can be done by altering the following lines in the Javascript

var GR_URL = ''; //change to the path where Goodreads helper script has been installed
var PDA_URL = ''; //change to the path where PDA app has been installed

Additionally a simplified version of the bookmarklet which takes a user to the Goodreads page for an item and allows them to add it is also available. It can be installed by dragging the "Add to Goodreads" link featured below into your browser toolbar.

Add to Goodreads

Follow the OCLC Developer Network:

The OCLC Developer Network supports the use of OCLC Web Services—a set of tools and APIs that expose data and services for WorldCat and our member libraries and partner institutions or companies. learn more »

© 2010 OCLC Domestic and international trademarks and/or service marks of OCLC Online Computer Library Center, Inc. and its affiliates


Powered by Drupal, an open source content management system