Skip to content
/ go-isbn Public

Simple golang package to get book details using ISBN

License

Notifications You must be signed in to change notification settings

abx123/go-isbn

Repository files navigation

go-isbn

GoDoc Go Report Card codecov License

Feature Overview

  • Retrieves book details using ISBN10 / ISBN13 from 4 providers:
    • Google Books
    • Open Library
    • Goodreads (requires env var GOODREAD_APIKEY to be set) free
    • ISBNDB (requires env var ISBNDB_APIKEY to be set) 7-day trial
  • Validates if a string is in valid ISBN10 / ISBN13 format

go-isbn will spawn equal number of go routines each querying a single provider with a max timeout of 3 seconds. First valid result will then be returned. Will return book not found only if all providers fail. Will default to all available providers if none is specified

Guide

Installation

go get github.com/abx123/go-isbn

Example

Querying on all 4 providers:

package main

import (
  "fmt"
  "log"

  goisbn "github.com/abx123/go-isbn"
)

func main() {
  // go-isbn instance
  gi := goisbn.NewGoISBN(goisbn.DEFAULT_PROVIDERS)

  // Get book details
  book, err := gi.Get("9780099588986")
  if err != nil{
    log.Fatalln(err)
  }
  fmt.Println(book)

Querying on selected providers:

package main

import (
  "fmt"
  "log"

  goisbn "github.com/abx123/go-isbn"
)

func main() {
  // go-isbn instance
  gi := goisbn.NewGoISBN([]string{
    goisbn.ProviderGoogle,
    goisbn.ProviderGoodreads,
  })

  // Get book details
  book, err := gi.Get("9780099588986")
  if err != nil{
    log.Fatalln(err)
  }
  fmt.Println(book)

About

Simple golang package to get book details using ISBN

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages