使用 Google Data API 搜索图书
我正在开发一个应用程序,用户可以在其中搜索特定的书籍并阅读和购买。我想使用 GData 图书搜索 API 来实现这一点。谁能告诉我将以哪种格式收到回复以及如何发送图书搜索请求?我看过 GData 文档,但没有得到太多想法。请帮我。
I'm developing an application in which user can search for a specific book and read it and purchase it. I want to use GData book search API for that. Can anyone tell me in which format I will get response as well as how to send request for book search? I have seen GData documentation, but not getting much ideas. Please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您必须发送 HTTP
GET
请求 如此处所示。这将返回一些您必须解析的 xml。每本书都是一个
,其中包含许多项目和,例如书籍封面的缩略图,如下所示:
不过,您真正关心的所有信息都将在此之后发送,并且将位于带有 < 的项目中code>dc 前缀,例如傲慢与偏见
你真的应该是 阅读文档,因为它比这里任何人都关心的更全面。
You are going to have to send an HTTP
GET
request as seen here. That will return some xml that you will have to parse. Each book is an<entry>
with lots of items and<link>
s to things such as a thumbnail of the book's cover, like this:All the information that you really care about though, will be sent after that, and will be in an item that has a
dc
prefix on it, such as<dc:title>Pride and Prejudice</dc:title>
You really should just be reading the documentation though, because it will be more thorough than anyone on here will care to be.
为此,您必须使用提要解析器。在 IE 中点击此 URL 并查看响应。它将返回饲料。您只需要提要解析器来解析它并在您的应用程序中显示。
Google 图书供稿
You have to use feed parser for this . Hit this URL in your IE and see the response. It will return feed. You just need feed parser to parse this and show in your application.
Google Books Feeds
如果您使用 Java,则应使用官方 适用于 Java 的 Google API 客户端库。
以下是将其与 Google 图书结合使用的详细文档。
注 1:Google Books API 提供图书搜索,但不提供内容访问。为此,您必须使用嵌入式查看器 API。这是一个仅限 Javascript 的 API,因此必须在浏览器中使用。如果您打算在 Android 上使用它,您很可能需要使用嵌入式 WebView 可以显示 HTML 和 Javascript。
注 2:商业书籍可以通过 Google 图书进行搜索,但必须先购买才能在用户图书馆中使用。 AFAIK 没有购买书籍的 API。
If you are using Java than you should use official Google APIs Client Library for Java.
Here are detailed docs hot to use it with Google Books.
NOTE 1: Google Books API provides book search, but does not provide access to content. For this you must use Embedded Viewer API. This is a Javascript only API so it must be used inside a browser. If you plan to use it with Android you will most probably need to use the embedded WebView which can show HTML and Javascript.
NOTE 2: Commercial books can be searched with Google Books, but they must be purchased before they are available in users library. AFAIK there is no API to purchase books.