php 如何从 ISBN 号中获取书名?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41469/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to fetch a Book Title from an ISBN number?
提问by pek
I am planning on creating a small website for my personal book collection. To automate the process a little bit, I would like to create the following functionality:
我正计划为我的个人藏书创建一个小型网站。为了稍微自动化这个过程,我想创建以下功能:
The website will ask me for the ISBN number of the book and will then automatically fetch the title and add it to my database.
该网站会询问我该书的 ISBN 号,然后会自动获取书名并将其添加到我的数据库中。
Although I am mainly interested in doing this in php, I also have some Java implementation ideas for this. I believe it could also help if the answer was as much language-agnostic as possible.
虽然我主要对用php做这个感兴趣,但我也有一些Java实现的想法。我相信如果答案尽可能与语言无关,它也会有所帮助。
回答by
This is the LibraryThing founder. We have nothing to offer here, so I hope my comments will not seem self-serving.
这是 LibraryThing 的创始人。我们在这里没有什么可提供的,所以我希望我的评论不会显得自私。
First, the comment about Amazon, ASINs and ISBN numbers is wrong in a number of ways. In almost every circumstance where a book has an ISBN, the ASIN and the ISBN are the same. ISBNs are not now 13 digits. Rather, ISBNs can be either 10 or 13. Ten-digit ISBNs can be expressed as 13-digit ones starting with 978, which means every ISBN currently in existence has both a 10- and a 13-digit form. There are all sorts of libraries available for converting between ISBN10 and ISBN13. Basically, you add 978 to the front and recalculate the checksum digit at the end.
首先,关于亚马逊、ASIN 和 ISBN 编号的评论在很多方面都是错误的。在几乎所有书籍有 ISBN 的情况下,ASIN 和 ISBN 都是相同的。ISBN 现在不是 13 位数字。相反,ISBN 可以是 10 或 13。十位 ISBN 可以表示为以 978 开头的 13 位,这意味着当前存在的每个 ISBN 都有 10 位和 13 位两种形式。有各种库可用于在 ISBN10 和 ISBN13 之间转换。基本上,您在前面添加 978 并在末尾重新计算校验和数字。
ISBN13 was invented because publishers were running out of ISBNs. In the near future, when 979-based ISBN13s start being used, they will not have an ISBN10 equivalent. To my knowledge, there are no published books with 979-based ISBNs, but they are coming soon. Anyway, the long and short of it is that Amazon uses the ISBN10 form for all 978 ISBN10s. In any case, whether or not Amazon uses ten or thirteen-digit ASINs, you can search Amazon by either just fine.
ISBN13 的发明是因为出版商的 ISBN 用完了。在不久的将来,当基于 979 的 ISBN13 开始使用时,它们将不再具有等效的 ISBN10。据我所知,目前还没有以 979 为基础的 ISBN 的出版书籍,但它们很快就会出现。无论如何,总而言之,亚马逊对所有 978 个 ISBN10 都使用 ISBN10 形式。在任何情况下,无论亚马逊是否使用十位或十三位的 ASIN,您都可以通过任一方式搜索亚马逊。
Personally, I wouldn't put ISBN DB at the top of your list. ISBN DB mines from a number of sources, but it's not as comprehensive as Amazon or Google. Rather, I'd look into Amazon—including the various international Amazons—and then the new Google Book Data API and, after that, the OpenLibrary API. For non-English books, there are other options, like Ozone for Russian books.
就个人而言,我不会将 ISBN DB 放在您列表的首位。ISBN DB 从多个来源挖掘,但不如 Amazon 或 Google 全面。相反,我会研究亚马逊——包括各种国际亚马逊——然后是新的谷歌图书数据 API,然后是 OpenLibrary API。对于非英语书籍,还有其他选择,例如俄语书籍的 Ozone。
If you care about the highest-quality data, or if you have any books published before about 1970, you will want to look into data from libraries, available by Z39.50 protocol and usually in MARC format, or, with a few libraries in Dublin Core, using the SRU/SRW protocol. MARC format is, to a modern programmer, pretty strange stuff. But, once you get it, it's also better data and includes useful fields like the LCCN, DDC, LCC, and LCSH.
如果您关心最高质量的数据,或者您有任何大约在 1970 年之前出版的书籍,您将需要查看来自图书馆的数据,这些数据可通过 Z39.50 协议获得,通常采用 MARC 格式,或者,有一些图书馆在都柏林核心,使用 SRU/SRW 协议。对于现代程序员来说,MARC 格式是非常奇怪的东西。但是,一旦你得到它,它也是更好的数据,包括有用的字段,如 LCCN、DDC、LCC 和 LCSH。
LibraryThing runs off a homemade Python library that queries some 680 libraries and converts the many flavors of MARC into Amazon-compatible XML, with extras. We are currently reluctant to release the code, but maybe releasing a service soon.
LibraryThing 运行一个自制的 Python 库,该库查询大约 680 个库并将 MARC 的多种风格转换为与亚马逊兼容的 XML,以及附加功能。我们目前不愿意发布代码,但可能很快就会发布服务。
回答by HoLyVieR
Google has it's own API for Google Booksthat let's you query the Google Book database easily. The protocol is JSON based and you can view the technical information about it here.
Google 拥有自己的 Google 图书 API,可让您轻松查询 Google 图书数据库。该协议基于 JSON,您可以在此处查看有关它的技术信息。
You essentially just have to request the following URL :
您基本上只需要请求以下 URL:
https://www.googleapis.com/books/v1/volumes?q=isbn:YOUR_ISBN_HERE
https://www.googleapis.com/books/v1/volumes?q=isbn:YOUR_ISBN_HERE
This will return you the information about the book in a JSON format.
这将以 JSON 格式返回有关这本书的信息。
回答by jevakallio
Check out ISBN DB API. It's a simple REST-based web service. Haven't tried it myself, but a friend has had successful experiences with it.
查看ISBN DB API。这是一个简单的基于 REST 的 Web 服务。自己没试过,但朋友有过成功经验。
It'll give you book title, author information, and depending on the book, number of other details you can use.
它将为您提供书名、作者信息,以及您可以使用的其他详细信息的数量,具体取决于这本书。
回答by Nathan P.
Try https://gumroad.com/l/RKxO
I purchased this database about 3 weeks ago for a book citation app I'm making. I haven't had any quality problems and virtually any book I scanned was found. The only problem is that they provide the file in CSV and I had to convert 20 million lines which took me almost an hour! Also, the monthly updates are not delta and the entire database is sent which works for me but might be some work for others.
我大约 3 周前购买了这个数据库,用于我正在制作的图书引用应用程序。我没有遇到任何质量问题,几乎所有我扫描的书都被找到了。唯一的问题是他们以 CSV 格式提供文件,我必须转换 2000 万行,这花了我将近一个小时!此外,每月更新不是增量,而是发送整个数据库,这对我有用,但可能对其他人有用。
回答by Giovanni Galbo
I haven't tried it, but take a look at isbndb
我没试过,但看看isbndb
API Description: Introduction
ISBNdb.com's remote access application programming interface (API) is designed to allow other websites and standalone applications use the vast collection of data collected by ISBNdb.com since 2003. As of this writing, in July 2005, the data includes nearly 1,800,000 books; almost 3,000,000 million library records; close to a million subjects; hundreds of thousands of author and publisher records parsed out of library data; more than 10,000,000 records of actual and historic prices.
Some ideas of how the API can be used include:
- Cataloguing home book collections - Building and verifying bookstores' inventories - Empowering forums and online communities with more useful book references - Automated cross-merchant price lookups over messaging devices or phonesUsing the API you can look up information by keywords, by ISBN, by authors or publishers, etc. In most situations the API is fast enough to be used in interactive applications.
The data is heavily cross-linked -- starting at a book you can retrieve information about its authors, then other books of these authors, then their publishers, etc.
The API is primarily intended for use by programmers. The interface strives to be platform and programming language independent by employing open standard protocols and message formats.
API 说明:简介
ISBNdb.com 的远程访问应用程序编程接口 (API) 旨在允许其他网站和独立应用程序使用 ISBNdb.com 自 2003 年以来收集的大量数据。截至撰写本文时,2005 年 7 月,数据包括近 1,800,000 本书;近 3,000,000 百万条图书馆记录;近百万科目;从图书馆数据中解析出的数十万条作者和出版商记录;超过 10,000,000 条实际和历史价格记录。
关于如何使用 API 的一些想法包括:
- Cataloguing home book collections - Building and verifying bookstores' inventories - Empowering forums and online communities with more useful book references - Automated cross-merchant price lookups over messaging devices or phones使用 API,您可以按关键字、ISBN、作者或出版商等查找信息。在大多数情况下,API 的速度足以用于交互式应用程序。
数据是高度交叉链接的——从一本书开始,您可以检索有关其作者的信息,然后是这些作者的其他书籍,然后是他们的出版商等。
API 主要供程序员使用。该接口通过采用开放标准协议和消息格式,力求独立于平台和编程语言。
回答by GiriB
Although the other answers are correct, this one explains the process in a little more detail. This one uses the GOOGLE BOOKS API.
虽然其他答案是正确的,但这个答案更详细地解释了这个过程。这个使用 GOOGLE BOOKS API。
https://giribhatnagar.wordpress.com/2015/07/12/search-for-books-by-their-isbn/
https://giribhatnagar.wordpress.com/2015/07/12/search-for-books-by-their-isbn/
All you need to do is
1.Createan appropriate HTTP request
2.Send itand Receive the JSON object containing detail about the book
3.Extractthe title from the received information
The response you get is in JSON. The code given on the above site is for NODE.js but I'm sure it won't be difficult to reproduce that in PHP(or any other language for that matter).
您需要做的就是
1.创建一个适当的 HTTP 请求
2.发送它并接收包含该书详细信息的 JSON 对象
3.从接收到的信息中提取标题
您得到的响应是 JSON 格式。上面网站上给出的代码适用于 NODE.js,但我相信在 PHP(或任何其他语言)中重现它并不困难。
回答by aku
To obtain data for given ISBN number you need to interact with some online service like isbndb. One of the best sources for bibliographic information is Amazon web service. It provides you with all bibliographic info + book cover.
要获取给定 ISBN 号的数据,您需要与一些在线服务进行交互,例如isbndb。书目信息的最佳来源之一是亚马逊网络服务。它为您提供所有书目信息 + 书籍封面。
回答by Tom
You might want to look into LibraryThing, it has an APIthat would do what you wantand they handle things like mapping multiple ISBNs for different editions of a single "work".
您可能想查看LibraryThing,它有一个API可以执行您想要的操作,并且它们可以处理诸如为单个“作品”的不同版本映射多个 ISBN 之类的事情。
回答by Leigh Caldwell
As an alternative to isbndb (which seems like the perfect answer) I had the impression that you could pass an ISBN into an Amazon product URL to go straight to the Amazon page for the book. While this doesn't programmatically return the book title, it might have been a useful extra feature in case you wanted to link to Amazon user reviews from your database.
作为 isbndb 的替代方案(这似乎是完美的答案),我的印象是您可以将 ISBN 传递到亚马逊产品 URL 中,以直接转到该书的亚马逊页面。虽然这不会以编程方式返回书名,但如果您想从数据库链接到亚马逊用户评论,它可能是一个有用的额外功能。
However, this linkappears to shows that I was wrong. Actually what Amazon uses is the ASIN number and while this used to be the same as 10-digit ISBN numbers, those are no longer the only kind - ISBNs now have 13 digits (though there is a straight conversion from the old 10-digit type).
但是,此链接似乎表明我错了。实际上亚马逊使用的是 ASIN 编号,虽然这曾经与 10 位 ISBN 编号相同,但它们不再是唯一的类型——ISBN 现在有 13 位(尽管从旧的 10 位类型直接转换而来) )。
But more usefully, the same link does talk about the Amazon API which can convert from ISBN to ASIN and is likely to also let you look up titles and other information. It is primarily aimed at Amazon affiliates, but no doubt it could do the job if for some reason isbndb does not.
但更有用的是,同一个链接确实讨论了亚马逊 API,它可以从 ISBN 转换为 ASIN,并且可能还可以让您查找标题和其他信息。它主要针对亚马逊附属公司,但毫无疑问,如果由于某种原因 isbndb 没有,它可以完成这项工作。
Edit:Tim Spalding above points out a few practical facts about ISBNs - I was slightly too pessimistic in assuming that ASINs would not correspond any more.
编辑:上面的 Tim Spalding 指出了一些关于 ISBN 的实际事实——我有点过于悲观地假设 ASIN 不再对应了。
回答by datasn.io
You may also try this database: http://www.usabledatabases.com/database/books-isbn-covers/
你也可以试试这个数据库:http: //www.usabledatabases.com/database/books-isbn-covers/
It's got more books / ISBN than most web services you can currently find on the web. But it's probably an overkill for your small site.
它拥有的书籍/ISBN 比您目前在网络上可以找到的大多数网络服务都多。但这对您的小型网站来说可能是一种矫枉过正。

