Automating book citation search

两盒软妹~` 提交于 2019-12-24 09:18:36

问题


I have a list of books listed by their titles in a text file. I want to write a script which can use a web service like Google scholar or amazon to search for the books and return me a xml or bibtex file with citation info for each book. Which programming tools can I use for this kind of automated search ?


回答1:


Python would be my recommendation.

  • Get names from the text file, simple file reading
  • Construct a REST URL request to google's book API

    http://books.google.com/books/feeds/volumes?q=Elizabeth+Bennet&start-index=21&max-results=10

  • Simple python code to get data from this URL (may need an API key, would advise using urllib2 with error handling rather than urllib)

Sample code,

 import urllib
 url = 'http://foo.api.request'
 data = urllib.urlopen(url).read()
  • See the return schemas for this API (you can use the XML however you like).
  • See BibTeXML for conversion between the two formats.

HTH




回答2:


I think it could be useful if you specify what kind of script you want to write!

Anyway... you could do some low level work and write your own HttpRequest for google and amazon or you could just rely on their API for example: http://code.google.com/apis/books/

There is a great project which does something similar what you want to do, it's called Shelves. It's written for Android but should give you some ideas how to handle your requests. Instead of downloading some citations it's downloading the cover.

http://code.google.com/p/shelves/

Just as a quick side note, saving your books in a xml file could be an option as well. In some cases it makes parsing them easier.



来源:https://stackoverflow.com/questions/2217992/automating-book-citation-search

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