LibriVox API Discussion Thread

Comments about LibriVox? Suggestions to improve things? News?
Post Reply
tbook
Posts: 77
Joined: May 12th, 2012, 7:01 am

Post by tbook »

Thanks for the info! I'll go ahead with the current version, then, myself.
Working on iOS and Android apps for LibriVox. You can see the comments from the apps on our web site: LibriVox Audio Books
tbook
Posts: 77
Joined: May 12th, 2012, 7:01 am

Post by tbook »

I am working away at importing things, and I've noticed some oddities in some of the RSS URLs - it looks as though some things haven't been implemented in the script that generates them. For example, with librivox.org/rss/2763, I see the following missing items:

<genre><!-- project element=Genre --></genre>

<language><!-- project element=lang.code --></language>

and for each of the chapters:

<reader><!-- file element=reader --></reader>

I assume that at some point the comments will be replaced by the actual values.
Working on iOS and Android apps for LibriVox. You can see the comments from the apps on our web site: LibriVox Audio Books
bart
LibriVox Admin Team
Posts: 7618
Joined: February 16th, 2009, 9:17 am
Location: Utrecht, the Netherlands
Contact:

Post by bart »

I will post this as an error.
Thanks for telling me.

Bart
Alle Nederlandstalige projecten op de Librivox Boekenplank
readr
Posts: 4
Joined: April 15th, 2012, 11:54 pm

Post by readr »

Hello, I'm looking at the API and thinking of making an iOS app. Over at apigee.com on the console, for most searches using the New API documentation, I seem to get only the same results, including "Count of Monte Cristo" and "Bleak House" along with several dozen others. Please help.

For instance—

Code: Select all

GET http://librivox.org/api/feed/audiobooks/?author="Shakespeare"&title="romeo"&fields[]=title&format=json
Yields the following—

Code: Select all

HTTP/1.1 200 OK
X-Varnish:1936936168
Age:0
Date:Mon, 21 Oct 2013 01:53:10 GMT
Content-Length:1769
Via:1.1 varnish
Set-Cookie:****
Accept-Ranges:bytes
Content-Type:application/json
X-Powered-By:PHP/5.3.10-1ubuntu3.2
Server:Apache/2.2.22 (Ubuntu)

{
  "books": [
    {
      "title": "Count of Monte Cristo"
    },
    {
      "title": "Letters of Two Brides"
    },
    {
      "title": "Bleak House"
    },
    {
      "title": "Penguin Island"
    },
    {
      "title": "This Side of Paradise"
    },
    {
      "title": "Secret Garden"
    },
    {
      "title": "Twenty Years After"
    },
    {
      "title": "Adventures of Huckleberry Finn"
    },
    {
      "title": "Heart of Darkness"
    },
    {
      "title": "Odyssey"
    },
    {
      "title": "Märchen (Index aller Märchen)"
    },
    {
      "title": "Divine Comedy"
    },
    {
      "title": "Unbeaten Tracks in Japan"
    },
    {
      "title": "Canterville Ghost"
    },
    {
      "title": "Fábulas de Esopo, Vol. 1"
    },
    {
      "title": "Mother Goose in Prose"
    },
    {
      "title": "Uncle Tom's Cabin"
    },
    {
      "title": "Truth About Jesus.  Is He a Myth?"
    },
    {
      "title": "Foolish Dictionary"
    },
    {
      "title": "Ranald Bannerman's Boyhood"
    },
    {
      "title": "Fables de La Fontaine, livre 01"
    },
    {
      "title": "Dream Psychology"
    },
    {
      "title": "Winnetou I"
    },
    {
      "title": "Vindication of the Rights of Woman"
    },
    {
      "title": "Getting of Wisdom"
    },
    {
      "title": "Consolation of Philosophy"
    },
    {
      "title": "Emma"
    },
    {
      "title": "Mrs. Caudle's Curtain Lectures"
    },
    {
      "title": "Fábulas de Esopo, Vol. 2"
    },
    {
      "title": "Importance of Being Earnest"
    },
    {
      "title": "Story of a Stuffed Elephant"
    },
    {
      "title": "Wind in the Willows"
    },
    {
      "title": "Junior Classics (vol 1)"
    },
    {
      "title": "Lord Jim"
    },
    {
      "title": "Villette"
    },
    {
      "title": "Narrative of Arthur Gordon Pym of Nantucket"
    },
    {
      "title": "Merry Adventures of Robin Hood"
    },
    {
      "title": "Wives and Daughters"
    },
    {
      "title": "Poems Every Child Should Know"
    },
    {
      "title": "Art of War"
    },
    {
      "title": "Three Musketeers"
    },
    {
      "title": "Fábulas de Esopo, Vol. 3"
    },
    {
      "title": "Bible (LSG, 1910) NT 04: Évangile selon Jean"
    },
    {
      "title": "Amateur Cracksman"
    },
    {
      "title": "Girl of the Limberlost"
    },
    {
      "title": "Rosary"
    },
    {
      "title": "Golden mean to 5000 digits"
    },
    {
      "title": "Queen Lucia"
    },
    {
      "title": "Histoires ou Contes du temps passé avec des moralités"
    },
    {
      "title": "Last of the Mohicans"
    }
  ]
}
bart
LibriVox Admin Team
Posts: 7618
Joined: February 16th, 2009, 9:17 am
Location: Utrecht, the Netherlands
Contact:

Post by bart »

Thank you for reporting this problem.
It's already on our list.
We'll have to wait for the developers to fix it.
They are at the moment busy with other, more urgent problems.

Bart
Alle Nederlandstalige projecten op de Librivox Boekenplank
ekzemplaro
Posts: 2027
Joined: December 31st, 2011, 7:17 am
Location: Tochigi,Japan
Contact:

Post by ekzemplaro »

Hello readr san,

Welcome to LibriVox. I hope you enjoy it here.
Do you know the following works?

http://librivox.org/api/feed/audiobooks/author/Shakespeare?format=json

http://librivox.org/api/feed/audiobooks/title/%5Eromeo?format=json

As of now you need to select functions which work.
You learn which works by try-and-error.

Cheers,
Masa
RuthieG
Posts: 21957
Joined: April 17th, 2008, 8:41 am
Location: Kent, England
Contact:

Post by RuthieG »

Copied here from this thread.
pkosenko wrote:It seems impossible to get the Librivox API to work with $.getJSON() remote calls. If JSONP is not functioning to allow remote queries of the Librivox data base that can return data, then I can't create an interface in Drupal that will do an Ajax query of the Librivox database from another site.

$getJSON() always returns and error. I have tried this any variety of ways, introducing a callback to the GET URL, for example, but it always returns error.

var LibrivoxAPI = "https://librivox.org/api/feed/audiobooks/";
data = {
// this is data attached to the URL as a GET Query string
// JSONP callback CANNOT be sent in the data object
format: "jsonp",
author: "Melville"
};
$.getJSON(LibrivoxAPI, data, function() { alert("success");})
.success(function () { alert("second success"); })
.error(function () { alert("error"); })
.complete(function () { alert("complete"); });


This may be due to some quirk in the implementation of JSONP?

There is NO documentation to speak of the Librivox API, and none whatsoever about how to get JSONP data from a remote URL.

Any help from the Librivox programmers?

There seems to be no Librivox program to DOCUMENT the Librivox API . . . or at least document it adequately beyond a bare "list" without explanations.
My LV catalogue page | RuthieG's CataBlog of recordings | Tweet: @RuthGolding
tbook
Posts: 77
Joined: May 12th, 2012, 7:01 am

Post by tbook »

Sorry to be the bearer of bad news, but my impression is that the API is essentially broken, and there is no immediate effort being made to fix it. You can read the rest of this thread to learn about other problems. Hopefully, it will eventually get the attention it needs.
Working on iOS and Android apps for LibriVox. You can see the comments from the apps on our web site: LibriVox Audio Books
pkosenko
Posts: 21
Joined: December 6th, 2013, 3:34 pm
Location: Santa Monica, California, USA
Contact:

Post by pkosenko »

For the life of me, I cannot get JQuery $.getJSON() to return any data whatsoever. No matter how I configure the URL, including adding &callback=? to the end of it, I get an Ajax error. In other words, remote calls to the Librivox site do not seem to work. So I am guessing that JSONP calls are broken in the API?

The following always returns an error alert followed by a complete alert.

With or without the "callback=?" and various ways of using a data parameter.

var LibrivoxAPI = "https://librivox.org/api/feed/audiobooks/?format=json&author=Melville&callback=?";

$.getJSON(LibrivoxAPI, function() { alert("success");})
.success(function () { alert("second success"); })
.error(function () { alert("error"); })
.complete(function () { alert("complete"); });

OR:

var url = "https://librivox.org/api/feed/audiobooks/";

var data = {
// this is data to be sent to the server, it is attached to the URL as a GET Query string
format: "json",
author: "Melville"
};

$.getJSON(LibrivoxAPI, data, function() { alert("success");})
.success(function () { alert("second success"); })
.error(function () { alert("error"); })
.complete(function () { alert("complete"); });

It is not my setup. Other example $.getJSON() calls to OTHER web APIs work.
Last edited by pkosenko on December 11th, 2013, 2:19 am, edited 1 time in total.
ekzemplaro
Posts: 2027
Joined: December 31st, 2011, 7:17 am
Location: Tochigi,Japan
Contact:

Post by ekzemplaro »

Hello pkosenko san,

Welcome to LibriVox. I hope you enjoy it here.

LibriVox API is a guess game.

I just tested the two following 2 URLs with wget.
Both worked.

The following returned JSON.
The following returned '(' + JSON + ')'.
If you want to know what we can do with the current API.
Just visit the following page.
http://ekzemplaro.org/librivox/statistics/
I also use jQuery.

Cheers,
Masa
pkosenko
Posts: 21
Joined: December 6th, 2013, 3:34 pm
Location: Santa Monica, California, USA
Contact:

Post by pkosenko »

Masa:

Thanks.

Yes, I know that "url?format=json" will return a JSON data file. You can paste the URL in a browser and get the JSON file wrapped in an anonymous function. But that is not my problem.

My problem is that Ajax will not load it into a page. When I use .getJSON() I always get an error.

So HOW are you LOADING the JSON into your javascript? I downloaded all of the listed pages in your example, but there are no Ajax calls that I can see. I am probably missing something, but can you point out the function that LOADS the JSON data INTO the javascript?

<script src="/js/jquery-2.0.3.min.js"></script>
<script src="librivox_statistics.js"></script>
<script src="statistics_display.js"></script>
<script src="search_display.js"></script>
<script src="readers_display.js"></script>
<script src="id_info_display.js"></script>
<script src="notes_display.js"></script>
<script src="sort_by_size.js"></script>
<script src="sort_by_id.js"></script>
<script src="sort_by_date.js"></script>
<script src="display_books.js"></script>
<script src="librivox_filter.js"></script>
<script src="librivox_utility.js"></script>
<link rel="stylesheet" href="statistics.css">

If you are NOT using $.getJSON, WHAT are you using to LOAD the data into your "data-in" variable?

Maybe I am just
pkosenko
Posts: 21
Joined: December 6th, 2013, 3:34 pm
Location: Santa Monica, California, USA
Contact:

Post by pkosenko »

Are you using PHP to SAVE the JSON to YOUR OWN directory in order to avoid a remote Ajax call?

Is that because the Librivox feed folder does not allow remote JSON calls? The Librivox API does not mention any such thing. If it doesn't allow, it should . . . along with some explanation of how to do it.


function fetch_json_proc (text_months,file_json)
{
var array_going = new Array ("All status","completed","in progress");

var array_group = new Array ("Group & Solo","Group","Solo");

jQuery.getJSON (file_json,function (data_received) // <-------- IS THIS A CALL TO A JSON FILE SAVED TO YOUR OWN http://ekzemplaro.org/librivox/statistics/ DIRECTORY? Are you saving the JSON to your OWN site? That would be extra unnecessary overhead if it is required.

{
statistics_display_proc (text_months,data_received);

jQuery ("button.control").click (function ()
{
var mode = this.id;

jQuery ("button.control").css ("color","black");
jQuery ("#" + this.id).css ("color","blue");

switch (mode)
{
case "statistics":
statistics_display_proc
(text_months,data_received);
break;

case "search":
search_display_proc
(data_received,array_going,array_group);
break;

case "readers":
readers_display_proc
(data_received,array_going,array_group);
break;

case "id_info":
id_info_display_proc
(data_received,array_going);
break;

case "notes":
notes_display_proc (data_received);
break;
}
});
});
}
ekzemplaro
Posts: 2027
Joined: December 31st, 2011, 7:17 am
Location: Tochigi,Japan
Contact:

Post by ekzemplaro »

Hello pkosenko san,
pkosenko wrote:jQuery.getJSON (file_json,function (data_received) // <-------- IS THIS A CALL TO A JSON FILE SAVED TO YOUR OWN http://ekzemplaro.org/librivox/statistics/ DIRECTORY? Are you saving the JSON to your OWN site? That would be extra unnecessary overhead if it is required.
You are right.
Just browse librivox_statistics.js
jQuery (function ()
{
jQuery("#outarea_aa").html
("*** librivox_statistics *** start *** Dec/07/2013 ***");

var file_json = "latest_on_going.json";
The file is http://ekzemplaro.org/librivox/statistics/latest_on_going.json
Once you download this file, you can make my page run on your server. Please feel free to use it.
I update latest_on_going.json roughly every week.
I generate this file using LibriVox API & archive.org API.
I fetch cataloged date from archive.org as LibriVox API doesn't feed cataloged date.

A good news. LibriVox JSONP works. Here's an example.
http://ekzemplaro.org/librivox/api/example_author/

Cheers,
Masa
duke
Posts: 9
Joined: September 9th, 2013, 4:42 pm
Contact:

Post by duke »

Thank you, Masa!

I finally gave up on the official API, and used your JSON to populate my own MySQL database on my own hosted server.

The latest version of my app (http://BookmobileApp.com) now has search and browse-by-genre once again. You can also search by reader ID if you know it (enter "reader:1234" or just "r:1234" in search field).

Thanks again!

-Duke
Duke Browning -- Freshmowed Software -- Bookmobile Audiobook and Podcast Player
ekzemplaro
Posts: 2027
Joined: December 31st, 2011, 7:17 am
Location: Tochigi,Japan
Contact:

Post by ekzemplaro »

Hello Duke san,

Thank you for your message.
duke wrote:I finally gave up on the official API, and used your JSON to populate my own MySQL database on my own hosted server.
I'm happy to know somebody thinks my JSON is worth to use.

When LibriVox starts to support open source, I'll make a better JSON and try to make it available
at LibriVox site instead of my site.

Cheers,
Masa
Post Reply