Skip to content

Instantly share code, notes, and snippets.

@pastak
Last active December 15, 2015 02:19
Show Gist options
  • Save pastak/5186617 to your computer and use it in GitHub Desktop.
Save pastak/5186617 to your computer and use it in GitHub Desktop.
ブラウザのjsコンソールとかで実行してgetAmazon(0)で呼び出す。 https://affiliate.amazon.co.jp/gp/associates/network/main.html で実行したらいい感じにMarkdownで書名とamznリンクを吐いてくれるjs
function getAmazon(i){
//ISBNの一覧
var key=[
9784578012351,
4578012344,
9784578012368,
9784410811364,
9784796116961,
9784410273087,
9784410270482
];
var title="",url="";var result;
var field=document.getElementById("quicksearchfield");
field.value=key[i];
onChangeKeyword();
setTimeout(function(){
result=document.getElementById("searchresults");
document.querySelector(".getlink>map>area:nth-child(2)").click();
setTimeout(function(){
var box=document.getElementsByClassName("ap_content")[0];
box.getElementsByTagName("a")[0].click();
url=document.getElementById("longUrltextarea").value;
title=document.querySelector(".title>a").textContent;
console.log("* "+title+"\n * "+url);
if(++i<key.length){getAmazon(i)};
},500);
},1000);
//この辺のms指定は適当に
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment