0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Amazon URLやASINをISBNに変換する

Last updated at Posted at 2022-10-16

タイトルの通りAmazon URLやASINからISBNに変換します。

ライブラリ(asin2isbn)にしたのでこれを使用します。

npm install asin2isbn

ASIN→ISBN

import {convertAsin2Isbn} from "asin2isbn";

let res = convertAsin2Isbn("4596708460");
if (res.error != "") {
  console.log("ISBN : " + res.isbn13); //10桁ISBNの場合は isbn10
}

※Kindle ASINの場合は取得できません。

console.log(res.error); // => "KINDLE"

Amazon URL→ISBN

import {convertUrl2Isbn} from "asin2isbn";
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);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?