↑ Return to B40 Amazon Books Loader

PRIV B43 Amazon Books Loader

by
George Morgan
My articles
Follow on:

Page no: B43

Load Amazon Books is a new plugin that adds all books for one author to the site.

The design has three parts.

  1. The new plugin Author Post Type, that allows for the new post types Books, Video and Audio. 
  2. The “pure Amazon loader” that calls the Amazon API. The original specification is here and the DB design and mapping.
  3. A filter on the authors and contributors, that restrict the results of the Amazon search only to the required person. The author filter is here.

 

This page contains different GUI aspects and exception handling.

 

Empty first or last name should give exception

 

If the WordPress user has an empty first or last name, then bring an exception. “Fill both first and last name first!”

empty first or last name

Call to Amazon should fill params into GUI

When I press the “Add Books” Button under users, the params are set in the URL.

The GUI is just for testing. So the “Add Books” should
1) either fill the params in the GUI or
2) not show Amazon GUI but just the results

Preferred is 1), so can adjust the options

[niki]

This step is skiped. If you click on “add books” the books are automatical added.

call to amazon should fill params into gui

Add option for switched syntax in Amazon loader GUI <lastname> <firstname>

Polish name allows for Rybinski Krzysztof

Lastname space firstname

He has written 3 books, but they all get ignored by the filter.
We need an option so that we can get the books in this rare case.

At the same time you can remove the superfluous attributes category and post parent

IMPORTANT: We can do that manually, simply exchange first and last in the input, so I just need an estimate

(image missing)

Old Amazon API requests

Amazon Book Loader is not working currently

We had an old Amazon API request for taking books. Now it is fixed and worked normal.

Associate on Books Loader

T was missing at the beginning

AWS

Why do we need the AWS for loading books?

It is required by Amazon to access their database with books. Before you access and make queries to Amazon, you have to log in.

.

It is related to the author profile pages under the feed site menu.

Requirements

  1. A book is stored in the format of a post. Table WP_POSTS with a new subtype “book”.
  2. There are many books under one user. So one can close and open the data (the tab) for one book.
  3. (Have a thought about this) Theoretically the user can enter also videos/audios instead books. –> a new type attribute in the GUI (book, audio, video) with default book.
  4. Some fields MUST be entered. The rules are the same as for the table WP_POSTS, like publication date, post title
  5. Access Rights: The author can enter the data even when if he is only contributor or subscriber. The user can modify his books. Question: Which WP access profile does he need.
  6. Automatic Posts Archive/Page
  7. We must create automatically a sort of archive or page of all books for one author. This one is similar to the old Book GUI.

Books DB Structure

The wp_posts table is shown in the image below.

post_title = Title of book

post_date = Amazon Publication Date

post_content = Description in Amazon
post_excerpt= Description in Amazon

post_modified and post_modified_gmt= Each time the book is modified (GMT Time), see comment on versioning

Post_name ?? difference to post_title or is it URL?

Post_parent: should be the full author profile URL, check if this work

menu_order:

Featured image (in post_meta): We set the Featured Image for a book manually.

Reload Books

How to

  • Go trough every single blog
  • Go into Users panel
  • Sort by post number
  • Click on button on every single authors
  • !! Only authors with more than 20 posts
  • Wait…
  • If there is an error, report here
  • If not, close tab and do next author
  • !! You can generate authors of batch of 20 authors (open 20 tabs, wait, close them)

Additional attributes not existing in WP_POSTS


The additional attributes are not mandatory. They are probably stored in Post_meta.

  • Publisher
  • Manufacturer
  • Amazon Store
  • ISBN (European identifier)
  • ASIN (book identifier)
  • EAN (international identifier)
  • Edition
  • Number Pages
  • Link to Amazon / Youtube page

Versioning of “book posts” is not a must, but if it is easy to implement then we do it.

Final Mapping

The following is the mapping from Amazon API to our fields.

 

Table Target Fields Amazon API fields and example data Data Type Multiple Value Comment
WP_POST_META
Amazon_asin  <ItemAttributes><ASIN>000000</ASIN></ItemAttributes>
OR <ASIN>00000</ASIN>
 WP meta field  N
Amazon_author  <ItemAttributes><Author>Lal Hardy</Author></ItemAttributes>

OR <Author>Lal Hardy</Author>

LONGTEXT Y
Amazon_binding <ItemAttributes><Binding>Paperback</Binding></ItemAttributes> LONGTEXT Single value
amazon_condition <Feature>Condition: New</Feature> LONGTEXT ?? <feature> substructure to be analyzed

Amazon API does not return Feature

amazon_contributers  <ItemAttributes><Creator>XXXX</Creator></ItemAttributes>

OR <Creator>XXXX</Creator>

Y
amazon_ean <ItemAttributes><EAN>9780762436316</EAN></ItemAttributes> LONGTEXT N  Single value
amazon_edition  <ItemAttributes><Edition>XXXX</Edition></ItemAttributes> LONGTEXT N  Contains numbers and text
amazon_isbn <ItemAttributes><ISBN>076243631X</ISBN><ItemAttributes> LONGTEXT N
amazon_isbn13 <Feature>ISBN13: 9780762436316</Feature> LONGTEXT Not implemented, <feature> structure to be analyzed
amazon_lang  <ItemAttributes><Language>076243631X</Language><ItemAttributes>  Y
amazon_manufacturer <ItemAttributes><Manufacturer>Running Press</Manufacturer></ItemAttributes> LONGTEXT Y
amazon_number_of_items <ItemAttributes><NumberOfItems>1</NumberOfItems></ItemAttributes> LONGTEXT N String usually contains only numbers
amazon_number_of_pages  <ItemAttributes><NumberOfPages>XXX</Manufacturer></NumberOfPages> LONGTEXT N String usually contains only numbers
difference
amazon_pages <ItemAttributes><NumberOfPages>XXX</Manufacturer></NumberOfPages> LONGTEXT N String usually contains only numbers
amazon_product_group <ItemAttributes><ProductGroup>Book</ProductGroup></ItemAttributes>  LONGTEXT N
amazon_pubdate <ItemAttributes><PublicationDate>2009-03-10</PublicationDate></ItemAttributes>  LONGTEXT N
amazon_publisher <ItemAttributes><Publisher>Running Press</Publisher></ItemAttributes>  LONGTEXT N
amazon_store  From the GUI form
amazon_studio <ItemAttributes><Studio>Running Press</Studio></ItemAttributes>  LONGTEXT N
 amazon_title <ItemAttributes><Title>The Mammoth Book of Tattoos</Title></ItemAttributes>

OR <Title>The Mammoth Book of Tattoos</Title>

 LONGTEXT N
amazon_url  <DetailPageURL>http://amazon.xxx/xxxxxx</DetailPageURL>  LONGTEXT N
WP_POSTS
 id  Autogenerated N
post_date  Generated from amazon_pubdate with format YYYY-MM-DD  DATETIME N
post_title  Using  amazon_title, but with pre-formatting N
post_excerpt  Autogenerated N
post_content  <EditorialReviews><EditorialReview><Content>XXXXX</Content></EditorialReview></EditorialReviews>

but with pre-formatting

N
post_parent  EMPTY N
post_author Using Amazon_author but pre-formatted and compared with wp_users table N
post_type  books N
Other fields that are not empty??? Which fields have default values?

No ISBN-13 in Amazon

Amazon uses two different ISBN fields.
Old standard: ISBN-10. We currently use it.
New Standard: ISBN-13. We should load this field, too.

If we find it, we rename the GUI to ISBN-10 and ISBN-13

[niki] The amazon doesn’t give us ISBN-13, so we can’t load it.

ISBN 10 / ISBN 13

ISBN

Additional Doc: Link

 

What is the difference between ISBN 10 and ISBN 13?

ISBN stands for International Standard Book Number. In the past publishers used ISBN 10, which refers to ISBN numbers that are 10 digits long. In 2001, a working group was set up to revise the ISBN standard. In January 2007, the length of ISBN numbers was increased from 10 to 13 digits, to ensure that they did not run out of numbers.

The only difference between an ISBN 10 and an ISBN 13 are in the first three digits and the last digit. The first three digits are called the prefix element and the last digit is called the check digit. You can find further details about the format of ISBN numbers from the International ISBN Agency (Link).

ISBN 10-13

Example of an ISBN 10: ISBN 85-254-1293-7
Example of an ISBN 13: ISBN 978–85-254-1293-5

The prefix element is issued by GS1. Prefixes that have already been issued by GS1 are 978 and 979. The GS1 agency (Link) is responsible for issuing unique numbers, to ensure the reliable identification of products and assets. GS1 is responsible for issuing bar codes worldwide. The addition of the prefix element ensures that ISBN 13 is compatible with the worldwide bar coding scheme.

The ISBN number should be displayed in eye readable format along the top of the bar code and along the bottom in EAN barcode format. You can find out more about bar codes for books from Book Industry Communications (Link).

All ISBN numbers should now have 13 digits. If you have purchased ISBN 10s, you will need to convert them into ISBN 13s. You can convert them into ISBN 10s using an ISBN Convertor.

See more for B4x Amazon Books Loader