Awesome!  This looks like it probably does what I need, I'll have to 
play with it.

I'm still confused about the values:

"borrow - when the book is available to borrow from openlibrary"

What does this mean?  How does one borrow a book from openlibrary?  I 
wasn't aware there was such a service.

"restricted - when the book is available only to printdisabled. "

What does "printdisabled" mean?

Will this information be added to the OpenLibrary API documentation 
somewhere?  Or do I need to keep a copy of this email myself and not 
lose it, to refer back to it?  Obviously I am suggesting it ought to be 
added to the documentation.

Jonathan


Anand Chitipothu wrote:
> On 08-Nov-2010, at 9:06 AM, Jonathan Rochkind wrote:
>
>   
>> I think the answer is, there is another API, the "REST" one, but it won't 
>> even tell me _anything_ about whether digitized copies are available?
>>
>> http://openlibrary.org/books/OL6511983M.json
>>
>> My suggestion is still that I think discovering online copies at the IA is 
>> one of the most attractive use cases for the OL/IA, and I'd encourage you to 
>> provide for the API to support it. 
>>
>> I'm beginning to have deja vu, I think maybe we've had this same 
>> conversation before a year or two ago? 
>>
>> My use case: Using _some_ simple OL/IA api, look up a book by isbn, lccn, or 
>> any other identifying numbers you may have. If I get a hit in the OL 
>> database, find out easily from the API if online versions are avaialable at 
>> the IA, and if so what URL they can be accessed at. 
>>
>> While this information is available on the HTML OL page for an edition, I 
>> believe maybe there's no way to get it from an API at all?  I guess I could 
>> find the OL identifier from the API, and then screen-scrape the HTML?
>>     
>
> I've extended the OL Books API to support this. (running on my dev server 
> right now)
>
> $ curl -s 
> 'http://anand.openlibrary.org/api/books?bibkeys=OL22336175M,OL24218576M,OL1114172M&format=json'
>  | rejson
> {
>     "OL24218576M": {
>         "bib_key": "OL24218576M", 
>         "preview": "borrow", 
>         "thumbnail_url": "http://covers.openlibrary.org/b/id/6558913-S.jpg";, 
>         "preview_url": 
> "http://www.archive.org/details/romanceonthreele00hafnrich";, 
>         "info_url": 
> "http://anand.openlibrary.org/books/OL24218576M/A_romance_on_three_legs";
>     }, 
>     "OL22336175M": {
>         "bib_key": "OL22336175M", 
>         "preview": "full", 
>         "thumbnail_url": "http://covers.openlibrary.org/b/id/6465002-S.jpg";, 
>         "preview_url": 
> "http://www.archive.org/details/adventuresoftoms20twai";, 
>         "info_url": 
> "http://anand.openlibrary.org/books/OL22336175M/The_Adventures_of_Tom_Sawyer";
>     }, 
>     "OL1114172M": {
>         "bib_key": "OL1114172M", 
>         "preview": "restricted", 
>         "thumbnail_url": "http://covers.openlibrary.org/b/id/6599977-S.jpg";, 
>         "preview_url": "http://www.archive.org/details/pastaperfect00sant";, 
>         "info_url": 
> "http://anand.openlibrary.org/books/OL1114172M/Pasta_perfect.";
>     }
> }
>
> The value of "preview" is:
>
> full - when the book is available for reading
> borrow - when the book is available to borrow from openlibrary
> restricted - when the book is available only to printdisabled. 
>
> with jscmd=data, the API provides a lot more info.
>
> $ curl -s 
> 'http://anand.openlibrary.org/api/books?bibkeys=OL22336175M,OL24218576M,OL1114172M&format=json&jscmd=data'
> {
>     "OL24218576M": {
>         "title": "A romance on three legs", 
>         "url": 
> "http://anand.openlibrary.org/books/OL24218576M/A_romance_on_three_legs";, 
>         "key": "/books/OL24218576M", 
>         ...
>         "ebooks": [
>             {
>                 "borrow_url": 
> "http://openlibrary.org/books/OL24218576M/A_romance_on_three_legs/borrow";, 
>                 "availability": "borrow", 
>                 "preview_url": 
> "http://www.archive.org/details/romanceonthreele00hafnrich";, 
>                 "formats": {
>                     "djvu": {
>                         "url": 
> "http://www.archive.org/download/romanceonthreele00hafnrich/romanceonthreele00hafnrich.djvu";,
>  
>                         "permission": "restricted"
>                     }
>                 }
>             }
>         ]
>     }, 
>     "OL22336175M": {
>         "title": "The Adventures of Tom Sawyer", 
>         "url": 
> "http://anand.openlibrary.org/books/OL22336175M/The_Adventures_of_Tom_Sawyer";,
>  
>         "key": "/books/OL22336175M", 
>         "ebooks": [
>             {
>                 "availability": "full", 
>                 "preview_url": 
> "http://www.archive.org/details/adventuresoftoms20twai";, 
>                 "read_url": 
> "http://www.archive.org/stream/adventuresoftoms20twai";, 
>                 "formats": {
>                     "pdf": {
>                         "url": 
> "http://www.archive.org/download/adventuresoftoms20twai/adventuresoftoms20twai.pdf";
>                     }, 
>                     "djvu": {
>                         "url": 
> "http://www.archive.org/download/adventuresoftoms20twai/adventuresoftoms20twai.djvu";,
>  
>                         "permission": "open"
>                     }, 
>                     "epub": {
>                         "url": 
> "http://www.archive.org/download/adventuresoftoms20twai/adventuresoftoms20twai.epub";
>                     }, 
>                     "text": {
>                         "url": 
> "http://www.archive.org/download/adventuresoftoms20twai/adventuresoftoms20twai_djvu.txt";
>                     }
>                 }
>             }
>         ]
>     }, 
>     "OL1114172M": {
>         "title": "Pasta perfect.", 
>         "url": 
> "http://anand.openlibrary.org/books/OL1114172M/Pasta_perfect.";, 
>         "key": "/books/OL1114172M", 
>         ...
>         "ebooks": [
>             {
>                 "availability": "restricted", 
>                 "preview_url": 
> "http://www.archive.org/details/pastaperfect00sant";, 
>                 "formats": {
>                     "djvu": {
>                         "url": 
> "http://www.archive.org/download/pastaperfect00sant/pastaperfect00sant.djvu";, 
>                         "permission": "restricted"
>                     }
>                 }
>             }
>         ]
>     }
> }
>
> When the availability is full, read_url and available formats are provided. 
> When the availability is borrow, borrow_url is provided. 
>
> Sometimes the daisy file is not openly available. That can be found by 
> looking at the permission field.
>
> Please let me know if you have any comments or suggestions.
>
> Anand
> _______________________________________________
> Ol-tech mailing list
> [email protected]
> http://mail.archive.org/cgi-bin/mailman/listinfo/ol-tech
> To unsubscribe from this mailing list, send email to 
> [email protected]
>   
_______________________________________________
Ol-tech mailing list
[email protected]
http://mail.archive.org/cgi-bin/mailman/listinfo/ol-tech
To unsubscribe from this mailing list, send email to 
[email protected]

Reply via email to