How to specify Apostrophe and Spaces when using API?

Comments about LibriVox? Suggestions to improve things? News?
Post Reply
effahid
Posts: 1
Joined: May 29th, 2017, 3:43 am

Post by effahid » May 29th, 2017, 11:35 am

Hi All

First post here. I'm working on an Android APP which uses Librivox API and had a technical question.

In order to retrieve a set of a books for a specific genre, I'm able to do

https://librivox.org/api/feed/audiobooks?genre=poetry

The above works and i'm able to also specify the limit and offset.

However, how do I specify genres with spaces and apostrophes in the name?
For example, how do I get the books for the genre, for example

Children's Fiction > Action & Adventure ? ( which is available when browsing the catalog )

I tried to guess it but none of the action_adventure,action-and-adventure, childrens_fiction, childrens-fiction, children_fiction works

The Dev notes page only mentions specifying the genre name in the query, but that only works for single word genres.

Thank you

rillig
Posts: 77
Joined: January 5th, 2014, 4:47 pm

Post by rillig » March 25th, 2018, 5:43 pm

effahid wrote:
May 29th, 2017, 11:35 am
How do I specify genres with spaces and apostrophes in the name?
For example, how do I get the books for the genre, for example

Children's Fiction > Action & Adventure ? ( which is available when browsing the catalog )
I had a look at https://github.com/LibriVox/librivox-catalog/blob/master/application/libraries/Librivox_API.php, which is the code handling these API requests. In your case, that URL would be:

https://librivox.org/api/feed/audiobooks?genre=action%20%26%20adventure

That's not ideal since you also get books from other genres besides Children's Fiction. I'll have a look at the code. It should not be difficult to make the following work:

https://librivox.org/api/feed/audiobooks?genre=Children%27s%20Fiction%20%3E%20Action%20%26%20Adventure

I cannot promise any delivery date, though.

annise
LibriVox Admin Team
Posts: 29060
Joined: April 3rd, 2008, 3:55 am
Location: Melbourne,Australia

Post by annise » March 25th, 2018, 10:05 pm

This is a thread devoted to ways around the API viewtopic.php?f=24&t=44129 which is used by other app and similar users so you could look there
re the API - unfortunately we ran out of money when the software rewrite happened so things haven't changed.

Anne
Our objective is to make all books in the public domain available, for free, in audio format on the internet. - Hugh McGuire.

Post Reply