Skip to content

Instantly share code, notes, and snippets.

@mathfur
Created February 12, 2010 04:38
Show Gist options
  • Save mathfur/302299 to your computer and use it in GitHub Desktop.
Save mathfur/302299 to your computer and use it in GitHub Desktop.
// Ubiquityで使う
// すべての検索結果について、,url,title,docの組をとってくる
gglob: function(key){
var results = [];
$.ajax({
url: "http://www.google.co.jp/search",
data: {q: key},
async: false,
success: function(data,textStatus){
// サーチごとに
Utils.log(">>[success][start] data:");
Utils.log(data.slice(0,100));
$("h3 a",data).slice(0,10).each(function(){
// 検索結果ごとに
Utils.log(">[each][start] $(this):");
Utils.log($(this).html().slice(0,100));
var url = $(this).attr("href");
var title = $(this).html();
$.ajax({
url: url,
async: false,
success: function(resp,textStatus_){
results.push({
url: url,
title: title,
doc: $(resp)
});
}
});
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment