Quotes for a random book?

DiscussãoLibraryThing API Development

Aderi ao LibraryThing para poder publicar.

Quotes for a random book?

Este tópico está presentemente marcado como "adormecido"—a última mensagem tem mais de 90 dias. Pode acordar o tópico publicando uma resposta.

1atlefren
Editado: Nov 7, 2008, 6:03 am

I've figured out that it would be cool to be able to retrieve a random quote from a random book in my library and display it on my blog.

I know book quotes are in the common knowledge part, and can be accessed by the common knowledge API, and i've gotten as far with the "normal" api as to get the title, isbn etc of a random book.

What i thought to do next was to call the common knowledge api with the ISBN on my random book, retrieve the quotes (if any) and select a random one if there is more of them and display it.

pseudo-code:

get a random book (completed)

var randombook

call cc-api with randombook

if randombook has quotes
- get quotes
- if num_quotes >1 atlefren:
-- select random quote
- else
-- select the one quote
else (has no quotes)
- get new random book
- repeat untill we get a book with qoutes

any suggestions on how to accomplish this?

2timspalding
Nov 7, 2008, 6:50 am

Oh, I was going to make one of these. Hmmm... Well, it's on my plan to do. I'm not sure what to use of yours, or whether you want to wait or not.

3atlefren
Editado: Nov 7, 2008, 7:17 am

If you make it I could wait, as my knowledge of javascript is quite limited. And I can't figure out how to get hold of the the cc data from javascript..

So please, go ahead and make one for me ;)

Or give me a pointer on how to get the cc data

4atlefren
Nov 7, 2008, 7:33 am

Anf _if_ I am going to try and make it i need the work id of the book. I cannot see that it is returned, i only get "book_id", although i found a blog mentioning book.work
(http://renditionprotocol.blogspot.com/2008/04/librarythings-json-api.html)

is this property removed or what?