Import data from e.g Amazon like ISBN etc (A extended onebox solution for Amazon)

I would like to add a book review section at my site.

One box does some of the job like:

But is it possible to “hack” to a form like this?

Image

Title:
Author:
ISBN:
Book description:

Star rating from Amazon

2 Likes

Not totally clear what you are asking for here?

I can see:

Product details

On the page, so yeah technically one could build a onebox to scrape it, but I don’t think we want ISBN in there by default.

3 Likes

Well, yes. Sorry if I wasnt clear,

Im looking for a solution, if possible where I could past in the link to amazon.

Then greb the information from amazon and paste in automaticly into discourse like

image

Title: Robbins Basic Pathology, 10e (Robbins Pathology)

Author: Vinay Kumar MBBS MD FRCPath (Author),‎ Abul K. Abbas MBBS (Author),‎ Jon C. Aster MD PhD (Author)

Description: Part of the trusted Robbins and Cotran family *, Robbins Basic Pathology provides a readable, well-illustrated and concise overview of the principles of human pathology that’s ideal for today’s busy students. This thoroughly revised edition continues with a strong emphasis on pathogenesis and the clinical features of disease, adding new artwork and more schematic diagrams to further aid in summarizing key pathologic processes and expand the already impressive illustration program.

Rating: 5 stars

Or something like that, does it make sense?

I use ISBN all the time to make sure I get the right product and not a slightly different one.

It is very handy when you browse amazon.com but can only buy from amazon.fr :wink:

4 Likes

I agree the book onebox can be quite a bit better, maybe @maja can do a mock-up of some improved format, agree it makes sense to do something a bit more special for books @codinghorror thoughts?

I think as a minimum number of pages, book cover, author, hardcover vs softcover can be added

7 Likes

Cool If you will look at an extended onebox solution for Amazon :+1:

I changed the subject :wink:

Sure, I’ll take a look.

3 Likes

I’m finding this a bit tricky to scrape since the product details is an <ul> without any classes or ids on single list elements and details vary between books and between stores for different countries too, meaning they’re not always at the same position in a list.
Any suggestions what would be the best way to do it?

6 Likes

I would give up at that point; the data isn’t structured from this source, so it is impossible.

1 Like

I wonder, this is a long shot, could we regex the isbn and then search using Lookup by ISBN - Product Advertising API or some other proper api they offer?

Note I would not spend more than an hour exploring this, cause it can easily become a rabbit hole

8 Likes

It seems like there are a bunch of isbn api’s out there…

Like https://isbndb.com/api/v3/docs

If we take the isbn of the book above we get:
https://isbndb.com/book/ISBN-13:

https://isbndb.com/book/9780323353175

But Im not that advance coder - or any coder at all :slight_smile: So I dont know if it could be used…?

1 Like

I have explored this option and it seems to be a bit of an overkill (for an onebox). In order to use Lookup by ISBN by Amazon, one needs to sign up as an Amazon Associate (each locale has a different associate program) to then sign up for the Product Advertising API to finally obtain an AWSAccessKeyId. There are also requirements for the Associate program: Amazon has to review and approve the website where “ads” are placed, the account gets closed if there are no referrals from the website in 180 days…

ISBNdb looks a lot simpler, but it costs from $5/mo on to use their API.

Edit: Having written that, Google Books API looks like it could be of use.

9 Likes

Thank you for the time you are using on this subject @maja

Not to push, but do you @maja think you’ll give that a try?

Im curious as I really love to add a book review section at my site… :slight_smile:

And it would be much more easy if I just had to paste in a link and then info about the book was added :wink:

Quick thought but it strikes me it could be okay as long as this works in most cases, and also okay for any given book if the data is incomplete as long as it captures the most important stuff.

It seems like it’s not always the same data included, but (almost always?) in the same order / same text in the <b> tag in the <li>, so w/ perhaps string search + a few judicious if statements could get it to good enough.

So for example could look at #productDetailsTable and get whichever of these are present, and ignore if not found:

  • if (paperback || hardcover) then show page length, else [digital edition]
  • publisher
  • pub date
  • language
  • if (paperback || hardcover) then ISBN #s else ASIN
  • avg. customer review

Not sure how much trickier differences w/ international versions of Amazon make this, but even if it worked just for USA/UK for example and got data for 95% of books it could be useful.

I was working on it today and I hope it’ll be ready to open a pull request tomorrow. I figured out it is not really necessary to involve some third party API as @bts suggested, but I have to test it some more.

8 Likes

This is how the book onebox looks like with my changes. Opinions?

5 Likes

Looks good, but style wise I think a cunch can be de-emphasized, there is a lot of bold there, also can you include a screenshot on mobile?

1 Like

Wauw it looks great :smiley:

A few thought from my side.

  1. star rating below the description would make more sense, I think. The way I normally read about a book is the description, and then I see what other users think about the book.

  2. ISBN - in this case I can see you use the ISBN-10. In Denmark we more often use ISBN-13 - I dont know what is most common in the US?

  3. To save space: Publication date could be Release date, or what do you think?

  4. Book Length: To save space: Pages alternatively I think you should have a p after 952p

But it looks very great and much better then before! Thanks :kissing_heart: