How to retrieve book's information in XML/JSON from library of congress by ISBN

自古美人都是妖i 提交于 2019-12-05 18:42:58

问题


The Library of Congress has a site to search books by ISBN. A simple way to retrive book's information is using a URL like:

http://lccn.loc.gov/2009019559/mods

where it returns a XML structure that may parse easily. The URL requires a unique LCCN number in the the following format:

http://lccn.loc.gov/[lccn]/mods

I have a batch of books that has ISBN encoded in barcode. How may I retrieve/convert ISBN to LCCN in order to retrieve the XML data of the book?


回答1:


You can use the SRU catalog from the Library of Congress. The query would look something like this:

lx2.loc.gov:210/lcdb?version=1.1&operation=searchRetrieve&query=bath.isbn=[ISBN]&maximumRecords=1&recordSchema=mods

Replacing [ISBN] with the ISBN you want to look up

Within that response is an LCCN element. However, the catalog already returns MODS, so it might not be necessary to do anything at all.




回答2:


You may use the Google Books API, for example: https://www.googleapis.com/books/v1/volumes?q=LCCN2001051058

Answer is in JSON format. It includes both ISBN-10 and ISBN-13 identifiers. You will have to batch the requests using your favorite programming language, in Pharo Smalltalk with PetitJson parser and Zinc with HTTPS support it would be:

| parser lccnCollection |
parser := PPParserResource current parserAt: PPJsonParser.
lccnCollection := #('2001051058' '2001051058').
lccnCollection do: [: lccnNumber | 
    | json jsonObject |
    json := (Url absoluteFromText: 'https://www.googleapis.com/books/v1/volumes?q=LCCN' , lccnNumber) retrieveContents contents.
    jsonObject := parser parse: json.
    " ... retrieve ISSN from jsonObject, etc ... "].

Beware you may need an API key to make batch requests to Google.



来源:https://stackoverflow.com/questions/13667361/how-to-retrieve-books-information-in-xml-json-from-library-of-congress-by-isbn

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!