A library to help on the search for books on google books api

Overview

books_finder

A library to help on the search for books on the Google Books Api.

Usage

First of all, import the library:

import 'package:books_finder/books_finder.dart';

Querying books

To query books, just call the function queryBooks:

final List<Book> books = await queryBooks(
 'twilight',
 maxResults: 3,
 printType: PrintType.books,
 orderBy: OrderBy.relevance,
);

You can change a few parameters to make your query more specific:

Parameter Description Nullable
maxResults Set the max amount of results No
startIndex for pagination No
langRestrict Retrict the query to a specific language Yes
orderBy Order the query by newest or relevance Yes
printType Filter by books, magazines or both Yes
reschemeImageLinks Rescheme image urls from http to https No

Books

If you already have a Book object, you can call book.info to get all the book infos:

final info = book.info;
Parameter Description
title (String) Title of the book
authors (List<String>) All the authors names
publisher (String) The publisher name
publishedDate (DateTime) The date it was published
rawPublishedDate (String) The date it was published in raw format
description (String) Description of the book
pageCount (int) The amount of pages
categories (List<String>) The categories the book is in
averageRating (double) The average rating of the book
ratingsCount (int) The amount of people that rated it
maturityRating (String) The maturity rating
contentVersion (String) The version of the content
industryIdentifier (List<IndustryIdentifier>) The identifiers of the book (isbn)
imageLinks (List<Map<String, Uri>>) The links with the avaiable image resources
language (String) The language code of the book

Acknowledgements

  • @JimTim for industry identifiers and tests

Issues and feedback

Please file issues, bugs, or feature requests in our issue tracker.

To contribute a change to this plugin open a pull request.

Comments
  • Seems google wants a secure http request now

    Seems google wants a secure http request now

    From what I see it is still able to retrieve most of the data, only the image URL is not able to be retrieved.

    Screen Shot 2021-03-31 at 8 16 30 PM

    When I manually update the URL to use https instead of http it works fine.

    Screen Shot 2021-03-31 at 8 22 47 PM
    opened by tadaspetra 4
  • Sometimes publishedDate is only a year

    Sometimes publishedDate is only a year

    When I searched for Unorthodox, I noticed that there are some works where only the year is given. Then there was an array IndexOutOfBounds. I tried to solve it as simple as possible. Goes certainly still more elegantly.

    BR Tim

    opened by JimTim 3
  • publisherDate wasn't found in google books api json

    publisherDate wasn't found in google books api json

    Hello, I just used your library and noticed that 00-00-0000 was always used as published date. Then I found the reason for this and so I made a pull request to you. Does this work for you so far?

    I also noticed that the year in the changelog looks strange and so I adjusted it as it seems to make sense.

    Greetings from Germany

    opened by JimTim 1
  • QueryType

    QueryType

    We experienced some issues with fetching books without being able to filter them by specific query types (isbn, author etc). I added QueryType as a parameter to query books and wrote some tests to confirm, see #15

    opened by niklasenberg 0
  • Add missing properties

    Add missing properties

    • Renamed industryIdentifier to industryIdentifiers
    • Added BookInfo.previewLink, BookInfo.infoLink and BookInfo.canonicalVolumeLink
    • Added Book.saleInfo

    others

    • Implemented equality and json transforming to all classes

    Fixes #11

    opened by bdlukaa 0
  • Adding subtitle parameter to BookInfo

    Adding subtitle parameter to BookInfo

    Hi! We are using books_finder for our school project and noticed some book titles are split between the 'title' and 'subtitle' parameter that is retrieved in the .json from Google's API. We'd really like to use both to get the full title's of some of our books. I updated the BookInfo class and wrote a test for it, see #13

    enhancement 
    opened by niklasenberg 0
  • Preview Link

    Preview Link

    Hi, i'm using books finder for a school project , i 'm reading the documentation but I'm asking if it's possible to get the url of previewLink urk i am refer a this in the JSON"previewLink": "http://books.google.es/books?id=_i6bDeoCQzsC&printsec=frontcover&dq=%27clean+code%27&hl=&cd=2&source=gbs_api",

    opened by DavidGonzalezGaliana 0
  • Fix startIndex paramater

    Fix startIndex paramater

    When I was using this library, I noticed that the startIndex parameter was not working. I looked at the code and found that the startIndex was not built into the URL, so I added it.

    opened by Moomink 0
  • current test failed

    current test failed

    ✓ Get books
    Expected: 'preview-1.0.0'
      Actual: '0.0.1.0.preview.0'
       Which: is different.
              Expected: preview-1. ...
                Actual: 0.0.1.0.pr ...
                        ^
               Differ at offset 0
    package:test_api                 expect
    main.<fn>
    
    ✖ Get book with special id
    ✓ Get magazines
    ✓ Get magazine with special id
    ✓ Get toJson
    ✓ Get book with subtitle
    Expected: 'harry potter and the philosopher\'s stone'
      Actual: 'harry potter and the sorcerers stone'
       Which: is different.
              Expected: ... r and the philosophe ...
                Actual: ... r and the sorcerers  ...
                                      ^
               Differ at offset 21
    package:test_api                  expect
    main.<fn>
    
    ✖ Test QueryTypes
    Exited (1)
    
    opened by letyletylety 0
  • publishedDate and Format Exception

    publishedDate and Format Exception

    If you try to search "google"

    final List<Book> books = await queryBooks( 'google', maxResults: 3, printType: PrintType.books, orderBy: OrderBy.relevance, reschemeImageLinks: true, );

    Link to web query

    the second result is a book that has a different publishedDate format, i think ISO (2016-09-15T00:00:00+02:00) and it raises a format exception at books.dart line 241

    day = int.parse(publishedDateArray[2]);

    I think you can try to parse the date with something like

    `DateTime? publishedDate = DateTime.tryParse((json['publishedDate'] as String?) ?? '0000-00-00');

    if (publishedDate == null) {
      final publishedDateArray =
          ((json['publishedDate'] as String?) ?? '0000-00-00').split('-');
    
      // initialize datetime variable
    
      if (publishedDateArray.isNotEmpty) {
        // initialize date
        int year = int.parse(publishedDateArray[0]);
        int month = 1;
        int day = 1;
    
        // now test the date string
        if (publishedDateArray.length == 1) {
          // assume we have only the year
          year = int.parse(publishedDateArray[0]);
        }
        if (publishedDateArray.length == 2) {
          // assume we have the year and maybe the month (this could be just a speculative case)
          year = int.parse(publishedDateArray[0]);
          month = int.parse(publishedDateArray[1]);
        }
        if (publishedDateArray.length == 3) {
          // assume we have year-month-day
          year = int.parse(publishedDateArray[0]);
          month = int.parse(publishedDateArray[1]);
          day = int.parse(publishedDateArray[2]);
        }
        publishedDate = DateTime(year, month, day);
      }
    }`
    

    If I can help in any mode please tell me (but I'm NOT a professional developer).

    bug 
    opened by guidocimurro 1
  • Just a question.

    Just a question.

    I know this is just pulling from an API, but any chance you know why some cover images are faded, while most are not?

    For example the first 2 are faded, but then the rest are fine. I'm just displaying them using the URL provided from the search call.

    Screen Shot 2021-09-02 at 4 57 10 PM

    opened by tadaspetra 9
Releases(4.3.0)
  • 4.3.0(May 1, 2022)

    What's Changed

    • MINOR BREAKING Renamed BookInfo.industryIdentifier to BookInfo.industryIdentifiers
    • NEW Added the following properties to BookInfo:
      • .subtitle, .previewLink, .infoLink and .canonicalVolumeLink
    • NEW Added Book.saleInfo
    • NEW Implemented equality in all classes

    New Contributors

    • @niklasenberg made their first contribution in https://github.com/bdlukaa/books_finder/pull/13

    Full Changelog: https://github.com/bdlukaa/books_finder/compare/4.2.0...4.3.0

    Source code(tar.gz)
    Source code(zip)
  • 4.2.0(Jan 13, 2022)

  • 4.0.0(Mar 26, 2021)

Owner
Bruno D'Luka
have fun, no one lasts forever
Bruno D'Luka
Flutter-Animated-Library-of-Books - Flutter App - Animated Book Library

bookshelf A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

Ulfhrafn 1 Dec 4, 2022
Responsive Google Clone using Flutter & Custom Search API

Google Clone A completely Responsive Google Clone- Works on Android, iOS & Web! Features Responsive Google UI Fetches Results from Google's Custom Sea

Rivaan Ranawat 28 Jan 6, 2023
Beautiful Weather App using API with support for dark mode. Created by Jakub Sobański ( API ) and Martin Gogołowicz (UI, API help)

Flutter Weather App using API with darkmode support Flutter 2.8.1 Null Safety Beautiful Weather App using https://github.com/MonsieurZbanowanYY/Weathe

Jakub Sobański 5 Nov 29, 2022
Flutter book library - Book Library Application with Flutter and Google Book API

Book Library Application Flutter iOS, Android and Web with Google Book API Demo

Nur Ahmad H 0 Jan 25, 2022
Github-search - Allows users to search users on github Uses flutter

Github Search Github Search is a cross-platform mobile application powered by Flutter Framework and Github API. The application was built with simplic

Saul 3 Sep 13, 2022
Starlight search bar - Starlight search bar with flutter

starlight_search_bar If you find the easiest way to search your item, this is fo

Ye Myo Aung 1 Apr 20, 2022
A note-taking app powered by Google services such as Google Sign In, Google Drive, and Firebase ML Vision.

Smart Notes A note-taking app powered by Google services such as Google Sign In, Google Drive, and Firebase ML Vision. This is an official entry to Fl

Cross Solutions 88 Oct 26, 2022
A simple library providing programmatic access to the iTunes search API for podcasts.

A library for searching for podcasts, parsing podcast RSS feeds and obtaining episodes details. Supports searching via iTunes and PodcastIndex (previe

Ben Hills 23 Dec 28, 2022
Federico 1 Feb 3, 2022
Get google api credentials - A Dart CLI app to obtain credentials for accessing Google APIs

get_google_api_credentials A Dart CLI app to obtain credentials for accessing Go

null 1 Jan 28, 2022
Help developers build the most beautiful search bar🍹.

fsearch Help developers build the most beautiful search bar ?? . [FSearch] provides developers with a one-stop search bar construction service. Suppor

Fliggy Mobile 70 Oct 28, 2022
A package help you to make api call and handle error faster, also you can check for internet before call api.

http_solver ##not for production use, only for learning purpose. A package help you to make api call and handle error faster, also you can check for i

Abdelrahman Saed 1 Jun 18, 2020
A Mobile Application to Download Books

LibHive (Android) - Download Free Books, PDFs, Epubs LibHive is an mobile application where you can search,download,save books anytime. These books ar

Abiraj Rajendran 13 Nov 17, 2022
Computer science courses, books and exams in your pocket. Built with Flutter and Free! ❤️

Computeiro - Free courses, books and exams Computer science exams in your pocket. Built with Flutter. Free Courses • Contributing ❤️ • License This pr

Felipe Augusto 31 Nov 27, 2022
flutter app to manage books and authors data using graphql on hasura.io

GraphQL Book Lisitngs with Proper Providers or without Providers. In this flutter project we use GraphQL with backend as hasura. Getting Started Pleas

Syed Uzair 5 Nov 7, 2022
a incremental list of books for random sorting.

tbr A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this is y

BiaAlice 2 Oct 9, 2022
Youtube API in Dart app. Used for downloading media and search request.

Youtube API Youtube API made by using Dart and Flutter in a cross-platform app. Used for downloading media and search request. For an idea of how the

Avian Silviu-Gabriel 0 Nov 4, 2021
Search and view popular Youtube videos with Youtube API in Flutter App

getx_bottom_nav_sample The sample of AnimatedBottomNavBar with GetX 주요 Package 설명 1.url_launcher url_launcher pub.dev flutter 에서 인앱, 외부 브라우저로 연길 시켜 주는

Jacob Ko 1 Dec 25, 2021
A fully functional Movies Application built with Flutter. The application built with null safety and clean architecture, also uses OMDB API for fetching movies in the search item

Cinema DB Project Details This project uses null safety feature Project uses clean code architecture (Uncle Bob's Architecture) Project can run on bot

Dhruvam 2 Oct 1, 2022