Openlibrary.Book (openlibrary v0.3.0)

Copy Markdown

Provides functions to find books from OpenLibrary.org by ISBN, LCCN, or OCLC identifiers.

Summary

Functions

Fetch book information for given ISBN 10 or ISBN 13 number. Returns a map if result is found, nil if no result is found and :invalid_isbn if invalid.

Fetches book information for a list of ISBNs. Returns a map where the keys are the ISBNs and the values are the corresponding book information.

Fetch book information using Library of Congress catalog number.

Fetches book information for a list of LCCNs (Library of Congress Control Numbers). Returns a map where the keys are the LCCNs and the values are the corresponding book information.

Fetch book information using Worldcat Control Number.

Fetches book information for a list of OCLC (Worldcat Control Numbers). Returns a map where the keys are the OCLCs and the values are the corresponding book information.

Functions

find_by_isbn(isbn)

Fetch book information for given ISBN 10 or ISBN 13 number. Returns a map if result is found, nil if no result is found and :invalid_isbn if invalid.

> Openlibrary.Book.find_by_isbn("0812511816")
# %{ title: "The Eye of the World", authors: [%{}, %{}], ... }

> Openlibrary.Book.find_by_isbn("invalidisbn")
# :invalid_isbn

> Openlibrary.Book.find_by_isbn("isbn not present in db")
# nil

find_by_isbns(isbns)

Fetches book information for a list of ISBNs. Returns a map where the keys are the ISBNs and the values are the corresponding book information.

Examples

> Openlibrary.Book.find_by_isbns(["0812511816", "0451524934"])
# %{
#   "ISBN:0812511816" => %{ title: "The Eye of the World", authors: [%{}, %{}], ... },
#   "ISBN:0451524934" => %{ title: "1984", authors: [%{}, %{}], ... }
# }

> Openlibrary.Book.find_by_isbns(["invalidisbn", "isbn not present in db"])
# %{
#   "ISBN:invalidisbn" => nil,
#   "ISBN:isbn not present in db" => nil
# }

find_by_lccn(lccn)

Fetch book information using Library of Congress catalog number.

> Openlibrary.Book.find_by_lccn("lccn")
# %{ title: "The Eye of the World", authors: [%{}, %{}], ... }

find_by_lccns(lccns)

Fetches book information for a list of LCCNs (Library of Congress Control Numbers). Returns a map where the keys are the LCCNs and the values are the corresponding book information.

Examples

> Openlibrary.Book.find_by_lccns(["lccn1", "lccn2"])
# %{
#   "LCCN:lccn1" => %{ title: "The Eye of the World", authors: [%{}, %{}], ... },
#   "LCCN:lccn2" => %{ title: "1984", authors: [%{}, %{}], ... }
# }

> Openlibrary.Book.find_by_lccns(["invalidlccn", "lccn not present in db"])
# %{
#   "LCCN:invalidlccn" => nil,
#   "LCCN:lccn not present in db" => nil
# }

find_by_oclc(oclc)

Fetch book information using Worldcat Control Number.

> Openlibrary.Book.find_by_oclc("oclc")
# %{ title: "The Eye of the World", authors: [%{}, %{}], ... }

find_by_oclcs(oclcs)

Fetches book information for a list of OCLC (Worldcat Control Numbers). Returns a map where the keys are the OCLCs and the values are the corresponding book information.

Examples

> Openlibrary.Book.find_by_oclcs(["oclc1", "oclc2"])
# %{
#   "OCLC:oclc1" => %{ title: "The Eye of the World", authors: [%{}, %{}], ... },
#   "OCLC:oclc2" => %{ title: "1984", authors: [%{}, %{}], ... }
# }

> Openlibrary.Book.find_by_oclcs(["invalidoclc", "oclc not present in db"])
# %{
#   "oclc:invalidoclc" => nil,
#   "oclc:oclc not present in db" => nil
# }