Google Books API JSON和ISBN / VolumeID

时间:2014-11-04 21:41:14

标签: json google-api google-books

我有3000多本书,其中一些有ISBN号,有些没有。我正在尝试使用Google API搜索查询从JSON文件中获取他们的缩略图(可能是副标题和作者)。

我注意到每个搜索查询都会生成不同的JSON文件 - 这是正常的吗? VolumeID查询似乎返回更详细的JSON?我在下面列出了相关的JSON文件。

Setup = Win7,localhost,apache,php,chrome。

isbn:query:

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

返回以下JSON;

{
 "kind": "books#volumes",
 "totalItems": 1,
 "items": [
  {
   "kind": "books#volume",
   "id": "beSP5CCpiGUC",
   "etag": "cNL3l6PTv24",
   "selfLink": "https://www.googleapis.com/books/v1/volumes/beSP5CCpiGUC",
   "volumeInfo": {
    "title": "The 1989 World Book year book",
    "subtitle": "a review of the events of 1988 ; the annual supplement to the World book encyclopedia",
    "authors": [
     "Robert O. Zeleny"
    ],
    "publishedDate": "1989-02-01",
    "industryIdentifiers": [
     {
      "type": "ISBN_10",
      "identifier": "0716604892"
     },
     {
      "type": "ISBN_13",
      "identifier": "9780716604891"
     }
    ],
    "readingModes": {
     "text": false,
     "image": false
    },
    "pageCount": 576,
    "printType": "BOOK",
    "categories": [
     "Reference"
    ],
    "contentVersion": "preview-1.0.0",
    "imageLinks": {
     "smallThumbnail": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=5&source=gbs_api",
     "thumbnail": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=1&source=gbs_api"
    },
    "language": "en",
    "previewLink": "http://books.google.co.uk/books?id=beSP5CCpiGUC&dq=isbn:0716604892&hl=&cd=1&source=gbs_api",
    "infoLink": "http://books.google.co.uk/books?id=beSP5CCpiGUC&dq=isbn:0716604892&hl=&source=gbs_api",
    "canonicalVolumeLink": "http://books.google.co.uk/books/about/The_1989_World_Book_year_book.html?hl=&id=beSP5CCpiGUC"
   },
   "saleInfo": {
    "country": "GB",
    "saleability": "NOT_FOR_SALE",
    "isEbook": false
   },
   "accessInfo": {
    "country": "GB",
    "viewability": "NO_PAGES",
    "embeddable": false,
    "publicDomain": false,
    "textToSpeechPermission": "ALLOWED",
    "epub": {
     "isAvailable": false
    },
    "pdf": {
     "isAvailable": false
    },
    "webReaderLink": "http://books.google.co.uk/books/reader?id=beSP5CCpiGUC&hl=&printsec=frontcover&output=reader&source=gbs_api",
    "accessViewStatus": "NONE",
    "quoteSharingAllowed": false
   }
  }
 ]
}

volumeId查询;

https://www.googleapis.com/books/v1/volumes/beSP5CCpiGUC

我得到以下JSON;

{
 "kind": "books#volume",
 "id": "beSP5CCpiGUC",
 "etag": "Zx4P5cYhhLU",
 "selfLink": "https://www.googleapis.com/books/v1/volumes/beSP5CCpiGUC",
 "volumeInfo": {
  "title": "The 1989 World Book year book",
  "subtitle": "a review of the events of 1988 ; the annual supplement to the World book encyclopedia",
  "authors": [
   "Robert O. Zeleny"
  ],
  "publisher": "World Book",
  "publishedDate": "1989-02-01",
  "industryIdentifiers": [
   {
    "type": "ISBN_10",
    "identifier": "0716604892"
   },
   {
    "type": "ISBN_13",
    "identifier": "9780716604891"
   }
  ],
  "readingModes": {
   "text": false,
   "image": false
  },
  "pageCount": 576,
  "printedPageCount": 584,
  "dimensions": {
   "height": "26.00 cm"
  },
  "printType": "BOOK",
  "categories": [
   "Encyclopedias and dictionaries",
   "History",
   "Yearbooks",
   "Reference / Yearbooks & Annuals"
  ],
  "contentVersion": "preview-1.0.0",
  "imageLinks": {
   "smallThumbnail": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=5&imgtk=AFLRE736tSIRMcPp77lZYXBvTtzig6KA5oP0RmH9_4--kTDCuQzvlcknopkOZgyLzBFI_hPMd-6MJTcEO-VZZDFzeDCDkjdsiQ&source=gbs_api",
   "thumbnail": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=1&imgtk=AFLRE72NzXnCEhmuPOXXn9VNNBgc-uC37bUnfBkbN25dnVcmdSU8Y3E8rNQNCj7Im_YVWH2RXFeqdQ2tengtOsgCjSJh06Oypg&source=gbs_api",
   "small": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=2&imgtk=AFLRE73COelJADcztpk28bKnJ4GQP7Nn7ScPgUbyk90mt25jpcuoU-cDZD--gj9j3jwutTtkTu6bzVouAdjLxi-sy0AN35bD7A&source=gbs_api",
   "medium": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=3&imgtk=AFLRE73oXHyjFepDB-fitily_UF8UmnKZMrTes6ZVsa576_LNl5wczwkJmW6mv_4RK2_nExpPft8N72BXJ7WUzsGwDLCq-5rEw&source=gbs_api",
   "large": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=4&imgtk=AFLRE71psAjJeg1UFlkqIbh-5IiHVNYPmZW9bb9IQjps23zPD-TlXqQ6RGeVRUMPqYpSVWcYwY8zQnwNITxWLBqp_zgMzpMiYw&source=gbs_api",
   "extraLarge": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=6&imgtk=AFLRE70VKrBxxv8Q2Ltr3qhAwh3UMx3d3tv2r2bzwXvlu10_KpyA1TuM0_6RiIEkBe4ENHT21EH_xzPQBe7LWRBgU1IhozIoNQ&source=gbs_api"
  },
  "language": "en",
  "previewLink": "http://books.google.co.uk/books?id=beSP5CCpiGUC&hl=&source=gbs_api",
  "infoLink": "http://books.google.co.uk/books?id=beSP5CCpiGUC&hl=&source=gbs_api",
  "canonicalVolumeLink": "http://books.google.co.uk/books/about/The_1989_World_Book_year_book.html?hl=&id=beSP5CCpiGUC"
 },
 "saleInfo": {
  "country": "GB",
  "saleability": "NOT_FOR_SALE",
  "isEbook": false
 },
 "accessInfo": {
  "country": "GB",
  "viewability": "NO_PAGES",
  "embeddable": false,
  "publicDomain": false,
  "textToSpeechPermission": "ALLOWED",
  "epub": {
   "isAvailable": false
  },
  "pdf": {
   "isAvailable": false
  },
  "webReaderLink": "http://books.google.co.uk/books/reader?id=beSP5CCpiGUC&hl=&printsec=frontcover&output=reader&source=gbs_api",
  "accessViewStatus": "NONE",
  "quoteSharingAllowed": false
 }
}

欢迎任何建议,如果有更好或更有效的方法来检索缩略图/信息,请告诉我,因为这是一个个人开发项目,我愿意学习。

如有必要,我可以提供我当前的代码。

2 个答案:

答案 0 :(得分:5)

我决定选择https://www.googleapis.com/books/v1/volumes?q=isbn:0716604892,因为事实证明它更可靠和合适。

答案 1 :(得分:1)

我们在收到谷歌api的回复时遇到了同样的问题 如果您使用Google ID获取图书数据,则会返回尺寸和重量。如果您使用isbn获取图书数据,情况也是如此。

最好使用 google id ,如果你还有其他人使用isbn并获取所有google ID。