Skip to content

Instantly share code, notes, and snippets.

@gucchan22
Created June 15, 2016 14:43
Show Gist options
  • Save gucchan22/f2cad5d47e2225fb001439e039b7647c to your computer and use it in GitHub Desktop.
Save gucchan22/f2cad5d47e2225fb001439e039b7647c to your computer and use it in GitHub Desktop.
javascript:(function() {
if(window.location.href == "www.amazon.co.jp") {
var information = {};
Array.prototype.filter.call(document.getElementsByClassName("bucket"),function(x){return x.nodeName=="TD"})[0].innerText.split("\n").forEach(function(e){var regexp_res=null;if((regexp_res=e.match(/出版社\:(.+)|発売日:\s+(.+)|ISBN\-10\:\s+(\d+)/))){switch(e[0]){case"出":information["publisher"]=regexp_res[1];break;case"I":information["ISBN"]=regexp_res[3];break;case"発":information["year"]=regexp_res[2];break}}});
var d = {
title : document.getElementById("productTitle").innerHTML,
author : Array.prototype.map.call(document.getElementsByClassName("author"),function(x){if(x.className=="author notFaded"){return x.innerText}else if(x.className=="author"){return x.childNodes[1].innerText+x.childNodes[3].innerText.replace(/\s+/g,"")}}).join(""),
publisher: information["publisher"],
year : information["year"].split("/")[0],
isbn : information["isbn"],
nametext : "野獣先輩",
student_id : "1145141919",
email : "krsw@sfc.keio.ac.jp",
belong : "環境情報学部",
notice : "on"
};
console.log(d);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment