ScrapboxにAmazonの書影を取り込むブックマークレット
更新日:2020.07.16
作成日:2018.04.15
Scrapboxで読書メモを管理にするにあたり、書籍の画像が欲しくなったので、参考URLのブログを参考にブックマークレットを作成しました。
久しぶりにブックマークレットを作りましたが、モダンなブラウザではES2015(ES6)が標準で使えるようになったので嬉しいですね。
javascript:(() => {
const titleElement = document.getElementById("productTitle") || document.getElementById("ebooksProductTitle");
if (!titleElement) return;
const title = window.prompt('Scrap "Amazon" to your scrapbox.', titleElement.innerHTML);
if (!title) return;
const imageElement = document.getElementById("imageBlockContainer") || document.getElementById("ebooksImageBlockContainer");
if (!imageElement) return;
const image = imageElement.getElementsByTagName("img")[0];
const imageUrl = image.getAttribute("src");
const productUrl = document.querySelector('link[rel="canonical"]').href.replace(/amazon.co.jp\/.*\/dp/, 'amazon.co.jp/dp');
const lines=`[${imageUrl} ${productUrl}]\n#本`;
const body = encodeURIComponent(lines);
const pageTitle = encodeURIComponent(title.trim());
window.open(`https://scrapbox.io/your-project/${pageTitle}?body=${body}`);
})();
参考
- 楽天ブックス・楽天Koboから読書メモを作るBookmarklet - Scrapboxとあそぶ - Scrapbox
- Amazonの書籍商品ページからScrapboxに、書籍の画像付きページを作るブックマークレット | ひびテク
- Scrapboxに本の情報を取り込むブックマークレットを作りました – R-style
Action
- Bookmakletを使って書影をScrapboxへ送り、読書メモを追加する
Related contents

TECH
2018.08.10
「Scrapbox情報整理術」出版記念スペシャルに参加してきました

TECH
2018.05.23
「Scrapbox Drinkup #04 Tokyo Edition」イベントレポート

TECH
2019.12.13
Scrapbox Drinkup #11「2019年のScrapbox」をテーマにしたLT大会 / 最新情報

TECH
2019.11.11
Scrapboxで読書管理をするときのじぶんルール

TECH
2017.09.08
ASIN, JAN, ISBNコードについて

TECH
2017.02.19
Amazon Product Advertising APIを利用するためのIAMユーザ登録とアクセスキーの発行

2023.12.30
ブラケティング

2023.04.30
Scrapboxを読書ジャーナルとして利用する