The Google Books module is a filter module and an API for Google Books, that allows a user to insert rich Google book data into nodes via filters with data retrieved from the http://books.google.com domain.
The user of this filter module will be able to easily insert:
- book data from Google into pages using Drupal filters, There are options to include / exclude any data fields,
- a book cover image when it exists
- and for books with a full or partial preview, the Google Books reader for the volume.
- To create a content type that uses Google Books, a text field can be used with an text-format with Google Books enabled as a filter, see issue: https://www.drupal.org/node/2094187.
The starting framework of the code was based on the Book Post module to get ideas which gets data from Open Library instead of the Google Books API although little remains of that module other than the framework. The Google Books module API is different based on the data returned as well as the final aims of the module, although they do both return book data.
The Google Book search can be done with many types of search strings.
There are many search options with Google Books and many options to display that data within the Google Book module. The API pulls data from Google Books in a generic way.
Requirements / Dependencies
Drupal 7: No dependencies, it should just install.
Google Book Module, Install Instructions
- Copy the google_books directory into your desired modules directory. Generally this will be sites/all/modules.
- Goto the module admin page and check the box to enable the module a admin/modules
- Enable the Google Books input filter at: admin/config/content/formats. You will need to then select configure on one or more input types, like Full HTML or Filtered HTML, config/content/formats/full_html and/or admin/config/content/formats/filtered_html.
- Once you turn the filter on with the radio button at config/content/formats, put it in the order where the output is where you need it. That is, don't put it before a "filter out all HTML" filter if you want anything to display. the order until you are happy with it.
- Select the options for the information you want to display for your volume. You can display many fields, and some you will, no doubt, want to turn off.
- To test, go create a page or article, and then just place your Google Books search string inside [google_books: ] square brackets with the google_books: prefix on the filter tag. Google book allows many types of searching including full text, author, and even inside text. ISBNs and other standard identifiers work also. The google_books API is very flexible.
- After you save your node, if the filter was installed correctly you should see your book information with the data you selected. If your selected data is not visible for a volume, then it was not in the data returned from Google.
- See http://books.google.com/advanced_book_search to find some good ways of handling your search. Once you find a search you like, then just copy the string between the braces [google_books: ] .
- Also see: http://code.google.com/apis/books/docs/v1/using.html#PerformingSearch for specifics on performing a search.
GOOGLE API KEY for many requests per day
IMPORTANT NOTE: make sure the correct API key is applied specifically for Google Book data or the log will show errors and no books will appear while an incorrect API Key is in this field. Removing an incorrect key should resume normal book loads up to the default, unregistered limit, like 100 instead of 1000.
If your application will need many requests, your site will need to have a registered key from google as there appears to be an API limit (with a valid key) per day. The API Key can be created setup at:
- Need to create a key for the Books API
- then click on Quotas and will see:
- Courtesy Limit
Per-User Limit: 1.0 requests/second/user Used: 0% Courtesy Limit: 1,000 requests/day Link: Request more... Link: Set per-user limits...
If the per user limit "Request More" link is clicked, a new form to request more usage reads:
"Description: Please provide a description of your API usage."
Original issue reference: https://www.drupal.org/node/1925058
Possible search strings to pull data from Google Books. Currently this module will only pull the general volume information up for the filter. When the API is added then it is intended to make this more generic to return multiple specific volumes.
The filter returns nothing (empty string == "") if the book is not found by the given search string.
How to use the inline options
In line display options to override the global Google Books filter settings can be made by options after the search string. The format for the search strings and options are:
Use global display options:
In line options always come after the search string and are separated by a vertical bar, i.e. a '|' character.
[google_books:search string | option 1 | option 2 | option 3 | ... ]
Options to include are just used normally, like 'worldcat' while options to exclude in the display are prefaced by the 'no_' prefix.
[google_books:The Hobbit | no_librarything | no_image | viewer | title | no_description]
These are the content options:
worldcat / no_worldcat
openlibrary / no_openlibrary
librarything / no_librarything
pagecurl / no_pagecurl
titlelink / no_titlelink
image / no_image
reader / no_reader
Theming and Output
There are plenty of CSS classes embedded to be able to theme it up about anyway you wish. In fact there is one for each field based on the field name for very specific book data theming.
No Drupal 6 Support for Google Books
Only Drupal 7 (and soon 8) will be supported. Since most sites are upgrading soon this should not be an issue.
However, if someone out there wants to back port it, please, contact me.
The idea from this module came from Book Post. The Google Books module pulls Google Books data specifically and requires different handling of the returned data since the data structures returned are not the same.
This module also intends to extend to a generally useful Google Books API soon to be used for other modules.
Also I intend to give the user of the Google Books filter a large amount of control over what is displayed.
Development Reasons and Goals
I love books! Or I should say the written word since books are largely going electronic! I quickly knocked out this little fun module in spare time because I want to use it and hope others find it useful as well.
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: Content, Content Display, Education, Filters/Editors, Media, Third-party Integration
- Reported installs: 57 sites currently report using this module. View usage statistics.
- Downloads: 1,241
- Automated tests: Enabled
- Last modified: December 2, 2014