How to retrieve the anime ratings with the API?
Emasoft opened this issue · 5 comments
Hi!
I need to retrieve the rating (and maybe the number of voters) of an anime entry from the AnimeNewsNetwork Encyclopedia. But I cannot find the documentation on how to do that with the API.
I'm writing an addon for a certain popular media center that displays the rating of each anime from ANN. Currently it takes the rating score from IMDB like it does for movies, but for anime IMDB ratings are totally unreliable. For anime the ANN ratings are the most trustworthy on the web (thanks to the voters, a great community of historical users!), but I cannot find a way to query those from the ANN Encyclopedia API.
Can anybody help me with that? thanks.
ANN does not seem to expose user ratings via their API, and I'm not sure if they have plans to ever. I'll see if I can contact someone over there and bug them about getting it into the API.
For now, the best I can say would be to scrape the ratings data from the pages themselves.
e.g., Capture the HTML from http://www.animenewsnetwork.com/encyclopedia/anime.php?id=4658 and parse out the data from the <div id="ratingbox" class="ratings-collapsed">
section.
I contacted the ANN developer via their forums. He said that adding ratings data into the API sounds like a good idea but gave no timeline or indication that this will be done. Unless the ratings data comes through a different end point, no work on this side to be done.
Closing this out.
ANN does list the rating in their API responses now.
Look for example at this API response:
http://cdn.animenewsnetwork.com/encyclopedia/api.xml?anime=4658
I've asked the admin of ANN to add the rating to their API, and they just did it. If you load the above link to the xml api response you will see this new line now:
<ratings nb_votes="401" weighted_score="5.9867" bayesian_score="6.0353"/>
Note that the bayesian score is available only above a certain numer of votes. If the bayesian score is null or missing, use the weighted score.
Fast turn around on that from them...
I think the issue now is a bug in guzzle-services that I have a pull request in for (guzzle/guzzle-services#53), but I'll have to dig in and see if that is indeed the case or if this is a new bug.
My pull requests for guzzle-services were finally merged in. Have updated to use it in turn requiring an update to Guzzle 5.0. In turn, required overhauling how the tests work and finding out that you no longer need to call toArray()
on the result from the API.
Ratings data now coming through the API.