/asin2isbn

ASIN to ISBN (npm library)

Primary LanguageTypeScriptMIT LicenseMIT

asin2isbn

asin to isbn

Installation

npm install asin2isbn

Import

import { convertAsin2Isbn, convertUrl2Asin, convertUrl2Isbn } from "asin2isbn";

ASIN to ISBN

let res = convertAsin2Isbn("4596708460");
if (res.error != "") {
  console.log("ISBN : " + res.isbn13);
}

※Only paper books are available

For Kindle ASIN?

let res2 = convertAsin2Isbn("B09MYHB3X3");
console.log(res2.error); // => "KINDLE"

Amazon URL to ISBN

let res3 = convertUrl2Isbn(
  "https://www.amazon.co.jp/dp/4799215663/ref=cm_sw_r_tw_dp_5XW9TEXBPTC54CE90CE9"
);
if (res3.isbn != "") console.log("res3 ISBN : " + res3.isbn13);

ISBN to URL

The return value is a string or null.

console.log(convertIsbn2Url("9784799215661")); //https://www.amazon.co.jp/dp/4799215663

Others

URL to ASIN

convertUrl2Asin("https://....");

ISBN10 or ISBN13 → ISBN13 and ISBN10

console.log(convertIsbn("9784799215661"));
/**
 * {
    isbn13: "9784799215661",
    isbn10: "4799215663",
  }
 */

PR / Issues

Please PR or Issues if you have any questions.