Hi Nilanjan,

First off, I'm on the ol-tech list too, and I haven't seen this question
before. Hope no one minds me answering the question here, as this is where
I've seen it.

On 1 October 2014 15:42, nilanjan bhattacharya <nilanj...@live.com> wrote:

> I am trying to use the Ruby gem to access openlibrary.  I posted my query
> on the tech list, but there is no response.  I wonder if someone here can
> help.
>
> I want to figure out if a book has a ebook on openlibrary.
>
> Take a look at this:
> https://openlibrary.org/works/OL1940521W/Testing_computer_software
> The subjects show me 'In library' - I assume that means there is an ebook.
>

I don't know about the subject 'in library' -- it doesn't sound like a
reliable way to determine if a book has an e-book. Clicking on the subject
gives a list of  "241,107 works / 239,752 ebooks" so it doesn't look like a
valid conclusion to draw. The subject field should be the subject of the
work, these look like bad / misplaced data to me. Maybe someone else knows
what this is about.



>
> However, when I go to the actual book
> <https://openlibrary.org/books/OL1737246M/Testing_computer_softwarehttp://>
> I don't see the 'subjects' field.
>
> When I use the API I get the same behavior, i.e,. for the OL1940521W
> <https://openlibrary.org/works/OL1940521W/Testing_computer_software>
> record I see 'subjects', but not for OL1737246M
>
> Can you help me make sense of this?
>

I have had a look at the book in question and how it shows up in the ruby
gem, what I think you want to see is the 'ebooks' field as documented in
the books API https://openlibrary.org/dev/docs/api/books

The API request for the book you mentioned is
https://openlibrary.org/api/books?bibkeys=OLID:OL1737246M&jscmd=data  which
has the "ebooks" field there:

"ebooks": [{"formats": {"djvu": {"url":
"https://archive.org/download/testingcomputers00kane/testingcomputers00kane.djvu";,
"permission": "restricted"}}, "preview_url":
"https://archive.org/details/testingcomputers00kane";, "availability":
"restricted"}]

I was about to tell you the ruby Gem doesn't support this field, but
thats not true... You won't be able to see the ebooks if you use the
Rest Client, which is what I assume you tried first. You'll need to
use the Books Client / Openlibrary::Data :

data = Openlibrary::Data

book = data.find_by_olid('OL1737246M')

book.ebooks
 => 
[{"formats"=>{"djvu"=>{"url"=>"https://archive.org/download/testingcomputers00kane/testingcomputers00kane.djvu";,
"permission"=>"restricted"}},
"preview_url"=>"https://archive.org/details/testingcomputers00kane";,
"availability"=>"restricted"}]

Hope that answers your question!

Regards,
Charles.
_______________________________________________
Ol-discuss mailing list - Ol-discuss@archive.org
http://mail.archive.org/cgi-bin/mailman/listinfo/ol-discuss
Archives: http://www.mail-archive.com/ol-discuss@archive.org/
To unsubscribe from this mailing list, send email to 
ol-discuss-unsubscr...@archive.org

Reply via email to