Goodreads Developers discussion
      bugs
      >
    author/list is returning wrong start/end data
    
  
  
					date newest »
						  
						newest »
				
		 newest »
						  
						newest »
				 This is probably the same issue I had in this post.
      This is probably the same issue I had in this post.If it helps, here's the code in my app that addresses the issue. It's PHP, but pretty straightforward to translate to another language. In the comments, I note that the function call "$this->getBookReviews" does caching internally, and I just want to stress that the caching is essential to making this approach work without TOS violations.
Best of luck,
Justin
//$page is the the page number, $perpage is the number of books per page
public function getReviews($isbn, $page=1, $perpage=10, $rating=0, $leading=0) {
$reviews = array();
$masterpage = 1;
//loop until we find enough reviews to meet the requested criteria
do {
//first get reviews from the Goodreads API
//this function caches results, so repeated calls with the same parameters
//will not result in repeated API calls. It also rate limits calls to avoid
//API TOS violations
//100 reviews is the max that the Goodreads API will return,
//so always request that many
$data = $this->getBookReviews($isbn, $rating, $masterpage, 100); //always get 100 reviews to save on API calls
if (!isset($firstdata))
$firstdata = $data;
$rawreviews = GoodreadsParser::asArray($data->book->reviews->review);
//this section of code filters out reviews with an empty body (sometimes
//the reviews have a star rating only
$foundmore = false;
foreach ($rawreviews as $rawreview) {
if (strlen(trim($rawreview->body->value)) > 0) {
array_push($reviews, $rawreview);
$foundmore = true;
}
}
$reviewcount = count($reviews);
//increment the internal page counter for the loop
$masterpage++;
//foundmore breaks the loop when the end of the reviews has been reached
//also break the loop when the requested number of reveiws have been
//obtained
} while ($foundmore && $reviewcount < $perpage * $page);
... (more filtering code before returning the reviews)
 That page is really weird because its joining together two lists. Books where the author is the primary author, and books where they are the secondary authors.
      That page is really weird because its joining together two lists. Books where the author is the primary author, and books where they are the secondary authors.
    


 
http://www.goodreads.com/author/list/...
returns:
however, it only returns 50 books back.