asin to isbn
npm install asin2isbn
import { convertAsin2Isbn, convertUrl2Asin, convertUrl2Isbn } from "asin2isbn";
let res = convertAsin2Isbn("4596708460");
if (res.error != "") {
console.log("ISBN : " + res.isbn13);
}
※Only paper books are available
let res2 = convertAsin2Isbn("B09MYHB3X3");
console.log(res2.error); // => "KINDLE"
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);
The return value is a string or null.
console.log(convertIsbn2Url("9784799215661")); //https://www.amazon.co.jp/dp/4799215663
convertUrl2Asin("https://....");
console.log(convertIsbn("9784799215661"));
/**
* {
isbn13: "9784799215661",
isbn10: "4799215663",
}
*/
Please PR or Issues if you have any questions.