Google books API searching by ISBN

后端 未结 3 887
灰色年华
灰色年华 2020-12-13 02:08

I am trying to figure out how to search for a book by ISBN using the Google Books API. I need to write a program that searches for an ISBN then prints out the title, author,

相关标签:
3条回答
  • 2020-12-13 02:50

    Are you using the deprecated data API?

    With Books API v1 (from Labs) you could use the query

    https://www.googleapis.com/books/v1/volumes?q=isbn:<your_isbn_here>
    

    for example

    https://www.googleapis.com/books/v1/volumes?q=isbn:0735619670

    to query a book by its ISBN.

    You may want to look at Googles example code: BooksSample.java

    0 讨论(0)
  • 2020-12-13 02:50

    Can't you try like this as said in the developers guide developer guide if I did understand your task. You can do like this :

    BooksService booksService = new BooksService("myCompany-myApp-1");
    myService.setUserCredentials("user@domain.com", "secretPassword");
    
    String isbn = "9780552152679";
    URL url = new URL("http://www.google.com/books/feeds/volumes/?q=ISBN%3C" + isbn + "%3E");
    VolumeQuery volumeQuery = new VolumeQuery(url);
    VolumeFeed volumeFeed = booksService.query(volumeQuery, VolumeFeed.class);
    
    // using an ISBN in query gives only one entry in VolumeFeed
    List<VolumeEntry> volumeEntries = volumeFeed.getEntries();
    VolumeEntry entry = volumeEntries.get(0);
    

    Now using the VolumeEntry api look for your desired getXXXX() and use it in your code.I hope it will help you to solve your problem.

    0 讨论(0)
  • 2020-12-13 03:00

    $("form").submit(
      function(e) {
        e.preventDefault();
        var isbn = $('#ISBN').val();
        var isbn_without_hyphens = isbn.replace(/-/g, "");
        var googleAPI = "https://www.googleapis.com/books/v1/volumes?q=" + isbn_without_hyphens;
        $.getJSON(googleAPI, function(response) {
          if (typeof response.items === "undefined") {
            alert("No books match that ISBN.")
          } else {
            $("#title").html(response.items[0].volumeInfo.title);
            $("#author").html(response.items[0].volumeInfo.authors[0]);
            $("#publishedDate").html(response.items[0].volumeInfo.publishedDate);
          }
        });
      }
    );
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <form>
      <strong>Enter ISBN:</strong> <input type="text" id="ISBN" value="9781407170671">
      <input type="submit" id="submit">
    </form>
    Title: <span id="title"></span>
    <br> Author: <span id="author"></span>
    <br> Publication date: <span id="publishedDate"></span>

    0 讨论(0)
提交回复
热议问题