如何从ISBNdb.com获取图书的类别信息?

时间:2012-05-08 11:01:49

标签: api isbn

我可以轻松获取图书信息:

http://isbndb.com/api/books.xml?access_key=THEKEY&results=details&index1=isbn&value1=9781849152990

我可以轻松查找类别:

http://isbndb.com/api/categories.xml?access_key=Z&index1=category_id&value1=science.mathematics.geometry 

但是你怎么得到某本书的类别?我想提供ISBN代码,作为回报,我想获得类别?

2 个答案:

答案 0 :(得分:8)

查看their API docs并稍微讨论一下,看来您可以做的最好的事情就是获取该书主题的列表,然后获取这些主题的类别。

所以,举个例子,给出一个0061031321的ISBN,你先打电话

  

http://isbndb.com/api/books.xml?access_key= $ž&安培;结果=受试者&安培; index1之间= ISBN&安培; VALUE1 = <强> 0061031321

返回

<BookData book_id="thief_of_time" isbn="0061031321" isbn13="9780061031328">
<Title>Thief of time</Title>
<TitleLong>Thief of time: a novel of Discworld</TitleLong>
<AuthorsText>Terry Pratchett</AuthorsText>
<PublisherText publisher_id="harpertorch">New York, N.Y. : HarperTorch, [2002], c2001.</PublisherText>
<Subjects>
<Subject subject_id="discworld_imaginary_place_fiction">Discworld (Imaginary place) -- Fiction</Subject>
<Subject subject_id="fantasy_fiction_aaaa0">Fantasy fiction</Subject>
</Subjects>
</BookData>

然后你遍历主题,得到他们的类别:

  

http://isbndb.com/api/subjects.xml?access_key= $ž&安培;结果=类别&安培; index1之间= subject_id&安培; VALUE1 = <强> discworld_imaginary_place_fiction

<...snip...>
<Categories>
<Category category_id="imaginary_places">Imaginary Places</Category>
<Category category_id="imaginary_places.discworld">Discworld</Category>
</Categories>
<...snip...>
  

http://isbndb.com/api/subjects.xml?access_key= $ž&安培;结果=类别&安培; index1之间= subject_id&安培; VALUE1 = <强> fantasy_fiction_aaaa0

<...snip...>
<Categories>
<Category category_id="genres.fantasy">Fantasy</Category>
</Categories>
<...snip...>

所以ISBN 0061031321的类别是:

  • 虚构的地方
  • 碟形世界
  • 奇幻

如果您想获得整个类别层次结构,可以通过categories.xml api追踪这些内容。

答案 1 :(得分:1)

我认为这也可能对某人有所帮助:

http://isbndb.com/api/books.xml?access_key=XXXXX&results=subjects,details,texts,prices&index1=isbn&value1=9780230749016

注意我如何使用逗号分隔键的“结果”?像魅力一样......