A script for Obsidian's QuickAdd plugin, to fetch books data using Google Books API.

Overview

Books script for Obsidian's Quickadd plugin

Demo

googleBooksDemo

If this script helped you and you wish to contribute :)

Buy Me A Coffee

Description

This script allows you to easily insert a book note into your Obsidian vault using Quickadd plugin by @chhoumann. Now also works on Mobile (make sure you use latest QuickAdd) ! Possible to query book using :

  • a book title or ISBN (10 or 13).
  • (optional) author name

It's also possible to query book using author name only (just skip book title prompt).

The (i) prefix in search suggestions indicates that an image is available for this book.

We use Google Books API to get the book information.

An API KEY for Google Books is needed to use this script : it can be obtained here. Steps to obtain this key are detailed below (see How to obtain Google Book's API key).

Disclaimer

The script and this tutorial are based on Macro_MovieAndSeriesScript.md by @chhoumann.

Please never run a script that you don't understand. I cannot and will not be liable for any damage caused by the use of this script. Regularly make a backup of your Obsidian's vault !

How to obtain Google Book's API key

  1. Visit this website.
  2. Login using your Google account.
  3. When prompted, accept the terms of use :

0

  1. Click on "Create a project" :

1

  1. Enter a project name :

2

  1. Back on the credentials page, click on "Create credentials" :

3

  1. In the menu that appeared, select "API Key" :

4

  1. You should see your API key. Close the window :

5

  1. Here is your API key :

key

  1. We must now enable Google Books API for this key. Back on the credentials page, click on "APIs and services" :

6

  1. Click on "Enable APIs and services" :

7

  1. Enter "Google books" in the search bar that appeared :

8

  1. Select "Books API" :

9

  1. Enable Google Books API by clicking on "Enable" :

10

Installation

googleBooksInstall

  1. Make sure you use latest Quickadd version (at least 0.5.1) !
  2. Save the script to your vault somewhere. Make sure it is saved as a JavaScript file, meaning that it has the .js at the end.
  3. Create a new template in your designated templates folder. Example template is provided below.
  4. Open the Macro Manager by opening the QuickAdd plugin settings and clicking Manage Macros.
  5. Create a new Macro - you decide what to name it.
  6. Add the user script to the command list.
  7. Add a new Template step to the macro. This will be what creates the note in your vault. Settings are as follows:
    1. Set the template path to the template you created.
    2. Enable File Name Format and use {{VALUE:fileName}} as the file name format. You can specify this however you like. The fileName value is the name of book without illegal file name characters.
    3. The remaining settings are for you to specify depending on your needs.
  8. Click on the cog icon to the right of the script step to configure the script settings. This should allow you to enter the API key you got from Google Books API. Make sure no spaces are inserted before or after the key !
  9. Go back out to your QuickAdd main menu and add a new Macro choice. Again, you decide the name. This is what activates the macro.
  10. Attach the Macro to the Macro Choice you just created. Do so by clicking the cog icon and selecting it.

You can now use the macro to create notes with book information in your vault !

Example template

Please also find a definition of the variables used in this template below (see : Template variable definitions).

# {{VALUE:title}}

Title:: {{VALUE:title}}
linking:: [[% Novels]] 
Tags:: #📥/📚/{{VALUE:tag}}
Author:: {{VALUE:authors}}
Publish date:: {{VALUE:release}}
Cover:: {{VALUE:thumbnail}}
ISBN10:: {{VALUE:isbn10}}
ISBN13:: {{VALUE:isbn13}}
URL:: [Goodreads]({{VALUE:goodreadsURL}})
Rating:: {{VALUE:rating}}
Read:: {{VALUE:read}}
Recommender:: {{VALUE:recommender}}
Date:: {{DATE}}
Comment:: {{VALUE:comment}}

Dataview rendering

Here is the dataview query used in the demo (replace PATH by your videogames notes path) :

TABLE WITHOUT ID

("[[" + file.name + "|" + Title + "]]") AS Title,
Author,
publish-date AS "Publish date",
("![coverImg|100](" + Cover + ")") as Cover,
rating AS "Rating",
Recommender,
Comment,
Date,
URL

FROM "PATH"

SORT Title

The banner at the top of the document is rendered using Obsidian-banners plugin.

Template variable definitions

Please find here a definition of the possible variables to be used in your template. Simply write {{VALUE:name}} in your template, and replace name by the desired book data, including :

fileName : Title of the book without illegal characters. Possibly used in template configuration to name your file.

title : The title of the book.

tag : A colored square that is red if unread, orange if read.

authors : Book's author.

release : The year this edition of the book was published.

thumbnail : A book cover, whenever possible.

isbn10 : The ISBN 10 of the book.

isbn13 : The ISBN 13 of the book.

goodreadsURL : An URL that uses the ISBN to request Goodreads book page. This may fail if ISBN returned by Google is not in the database of Goodreads.

rating : Your book rating, /10.

read : If you read the book, this equals 1, otherwise 0 (this helps to filter dataview query).

recommender : The person (or organization, etc...) that recommended the book to you.

comment : A short personal comment on the book.

You might also like...

This simple project aims to connect to an API to fetch score data and display it on a LeaderBoard box, as well as provide the tool to submit a new score.

      This simple project aims to connect to an API to fetch score data and display it on a LeaderBoard box, as well as provide the tool to submit a new score.

Leader Board: Hit the API! This simple project aims to connect to an API to fetch score data and display it on a LeaderBoard box, as well as provide t

Apr 6, 2022

"Choose your Pokemon" is a Webpack project meant to fetch data from two different APIs: PokéAPI and Involvement API

"Choose your Pokemon" is a Webpack project meant to fetch data from two different APIs: PokéAPI and Involvement API. Here we display a list of 20 Pokemons for whom one can like, display more info, and comment; all based on the data from these two external resources.

Mar 31, 2022

Search, fetch, and get data regarding United States presidents.

us-presidents Search, fetch, and get data regarding United States presidents. GitHub Documention Discord Examples Installation NPM npm install us-pres

May 7, 2022

fetch and process data in web worker, store in indexedDB.

fetch and process data in web worker, store in indexedDB.

Query+ install yarn add query-plus or pnpm add query-plus or npm install query-plus import import { useFetch, usePreFetch } from "query-plus" use

Aug 29, 2022

Awesome books is a simple website that displays a list of books and allows you to add and remove books from that list

Awesome books is a simple website that displays a list of books and allows you to add and remove books from that list

Awesome books is a simple website that displays a list of books and allows you to add and remove books from that list. By building this application, you will learn how to manage data using JavaScript. Thanks to that your website will be more interactive. built with modern JavaScript and uses SPA technology.

Mar 29, 2022

This website is dedicated to be able to store books, add new books and delete books.

This website is dedicated to be able to store books, add new books and delete books.

awesome-books This is a book shelve website dedicated to store collection of books, add new books and delete books. In this project, you will be using

Jul 4, 2022

"Awesome books" is a simple website that displays a list of books and allows you to add and remove books from that list.

Hello! I am a software developer! I can help you build a product, feature or website. Take a look of my works. If you like what you see and have a pro

May 9, 2022

This is an Awesome Books web page where users can add or remove books from the site. It also displays a list of the books added to the collection. This was a continuous project, where in each milestone, new feature(s) was/were added to it.

This is an Awesome Books web page where  users can add or remove books from the site. It also displays a list of the books added to the collection. This was a continuous project, where in each milestone, new feature(s) was/were added to it.

Awesome Books This is an Awesome Books web page where a user can add or remove books from the site. It also displays a list of the books that are adde

Aug 1, 2022
Comments
  • Added 5 fields

    Added 5 fields

    Hi Elaws,

    Thanks for producing such a robust script, I've been using it quite a bit over the weekend.

    I've added another 5 fields from the API that I quite like to have:

    • avRating - Average Rating reported by the API
    • genre - the categories field in the API
    • bookDesc - The blurb of the book
    • mature - A rating for whether or not a book is rated as MATURE or NOT_MATURE
    • pageCount - The total number of pages reported for the book

    This all works <--

    I also tried adding retail information, I like to sum up how much my books have cost me and how much I'll be spending on those I haven't read or bought yet, but I ran into an issue where it just does not exist in many cases.

    I tried:

    	const selectedBookRetail = selection.saleInfo.retailPrice;
    
    	let gprice = 0
            // Presence of retailPrice.amount indicates presence of currencyCode
    	if (typeof(selectedBookRetail.amount) !== "undefined") {
    		let getPrice = selectedBookRetail.amount
                    let getCurrency = selectedBookRetail.currencyCode
    	}
           ......
            currency: getCurrency
            price: getPrice
    

    But I don't know enough JavaScript to make this work completely. But I'll work on that if you don't want to. Thanks, DLBPointon

    opened by DLBPointon 0
Releases(v2.0)
Owner
Elaws
Elaws
Script to synchronize between a Notion database and Google Calendar both ways. Uses Google App Script.

Yet Another Two Way Notion-Google Calendar Sync Script A script to sync events between Google calendar and a Notion database. Features! Google App Scr

kat 41 Jan 7, 2023
This is a simple script to upload Multiple files into google drive using google drive API and Nodejs.

Welcome to gDrive Multiple File Upload ?? This is a simple script to upload Multiple files into google drive using google drive API and Nodejs Install

Jayamal Sanuka Hettiarachchi 1 Dec 29, 2021
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Google-Drive-Directory-Index | Combining the power of Cloudflare Workers and Google Drive API will allow you to index your Google Drive files on the browser.

?? Google-Drive-Directory-Index Combining the power of Cloudflare Workers and Google Drive will allow you to index your Google Drive files on the brow

Aicirou 127 Jan 2, 2023
This project is an Awesome Books web page where users can add or remove books from the site. It also displays a list of the books added to the collection. This Awesome books webpage was created using ES6.

Awesome books App using Module Awesome books App using Module This book list was built using modules and other ES6 syntax. It allows users to add/remo

Esther Udondian 6 Jul 25, 2022
simple jquery Plugin that utilizes Google API to get data from a Place on Google Maps

jQuery Plugin to display Google Reviews of a Place on Google Maps this will get the 5 reviews, google offers you. But I need more than 5 reviews! if y

Simon Neutert 32 Dec 14, 2022
Google Clone using NEXT JS ,SSR, Tailwind and Google API's to search data.

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Hamnaikbalkhan 7 Sep 23, 2022
"Awesome books" is a simple website that displays a list of books and allows you to add ang remove books from that list. Also you can store your data in your local storage. Build with JavaScript, HTML and CSS.

Awesome Books Creating an app that adds and delete books from a list. Built With HTML CSS JavaScript Application Page url https://TimmyChan99.github.i

Fatima Ezzahra elmenoun 5 Jan 28, 2022