【问题标题】:Is there a way to only search for specific kinds of books such as textbooks with Google Book Search API?有没有办法只搜索特定种类的书籍,例如使用 Google Book Search API 的教科书?
【发布时间】:2010-10-31 03:19:39
【问题描述】:
我注意到在 Google Book Search Java API 中的 VolumeQuery 上可以使用一些类,例如 CategoryFilter。这可以仅用于搜索特定类型的书籍,如教科书,还是有更好的方法来进行这种搜索?一般情况下,似乎没有太多在线示例或 API 中用于使用 Google Book Search API 的详细信息,所以我不太确定如何处理这个问题。提前致谢。
【问题讨论】:
标签:
java
api
search
google-books
【解决方案1】:
CategoryFilter 用于搜索用户标记的书籍:
VolumeQuery query = new VolumeQuery(
new URL("http://www.google.com/books/feeds/users/USER_ID/collections/library/volumes"));
CategoryFilter filter = new CategoryFilter();;
filter.addCategory(
new Category(BooksCategory.Scheme.LABELS_SCHEME, "favorite"));
query.addCategoryFilter(filter);
VolumeFeed volumeFeed = service.query(query, VolumeFeed.class);
参考:Data API: Developer's Guide, Java