views:

51

answers:

2

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 ?

A: 

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.

Layne
A: 

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)

    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

viksit
Okay, for some reason the code formatting isn't working here. Weird.
viksit