ornwipa / book_recommender

Final project for ComIT's FULL STACK .NET course
GNU General Public License v3.0
1 stars 1 forks source link

Public Reviews Included #36

Closed ornwipa closed 3 years ago

ornwipa commented 3 years ago

Incorporate reviews using Goodreads API goodreads-py: https://pypi.org/project/Goodreads/ | https://github.com/sefakilic/goodreads goodreads-dotnet: https://github.com/adamkrogh/goodreads-dotnet

Get the reviews for a book given a Goodreads book id

Get an XML or JSON response that contains embed code for the iframe reviews widget. The reviews widget shows an excerpt (first 300 characters) of the most popular reviews of a book for a given internal Goodreads book_id. Reviews of all known editions of the book are included.

XML responses also include shelves and book meta-data (title, author, et cetera). The Goodreads API gives you full access to Goodreads-owned meta-data, but it does not give you full access to book meta-data supplied by third parties such as Ingram. Book cover images, descriptions, and other data from third party sources might be excluded, because we do not have a license to distribute these data via our API.

If you need book meta-data beyond what our API provides, consider signing up for an Amazon developer key. URL: https://www.goodreads.com/book/show.FORMAT (sample url) HTTP method: GET Parameters:

Get the reviews for a book given an ISBN

Get an xml or json response that contains embed code for the iframe reviews widget that shows excerpts (first 300 characters) of the most popular reviews of a book for a given ISBN. The reviews are from all known editions of the book. URL: https://www.goodreads.com/book/isbn/ISBN?format=FORMAT (sample url) HTTP method: GET Parameters:

ornwipa commented 3 years ago

Two ways for HTTP Request

Python codes using goodreads library to get book description:

api_key = open("key","r").read()
api_secret = open("secret","r").read()

from goodreads import client
gc = client.GoodreadsClient(api_key, api_secret)

book = gc.book(isbn=1551927608) # or ISBN13: 9781551927602
print(book.description) # potential to add description

To get book review (available only with reference to review_id but not isbn, the review_id is extracted from https://www.goodreads.com/review/show/737648743?book_show_action=true&from_review_page=1):

review = gc.review(737648743)
print(review.body)