Skip to content

Instantly share code, notes, and snippets.

@user19
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save user19/bed9afc757dddce40ef3 to your computer and use it in GitHub Desktop.

Select an option

Save user19/bed9afc757dddce40ef3 to your computer and use it in GitHub Desktop.
var key = encodeURIComponent(encodeURIComponent(window.prompt("検索したいキーワードを入力してください。(複数も可)")));
var keywords = {};
var x = new XMLHttpRequest();
x.onload = function(){
var phrase = JSON.parse(x.responseText).query.results.json.json[1].json;
for(index1 in phrase){
var words = phrase[index1].split(/\s/);
for(index2 in words)
keywords[words[index2]] = null;
};
var str="";
for(var word in keywords)
str += word + ",";
window.prompt("以下の文字列をコピーして、タグ欄に張り付けてください。", str);
};
x.open("GET","https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url%3D'http%3A%2F%2Fsuggestqueries.google.com%2Fcomplete%2Fsearch%3Fds%3Dyt%26hl%3Dja%26client%3Dfirefox%26q%3D"+key+"'&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys",true);
x.send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment