写个函数,利用Greasemonkey根据域名抓取域名下的谷歌索引数量:

function checkgoogle(domain){
console.log("检查域名谷歌收录:"+domain);
GM_xmlhttpRequest({
method: "GET",
url: "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=site:"+domain+"&filter=0",
headers: {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0"
},
onload: function(response) {
result=JSON.parse(response.responseText);
if(result.responseStatus==403){
alert("请求被拒绝,请休息片刻再尝试");
clearTimeout(interval);
return false;
}
console.log(result);
sietnums=parseInt(result.responseData.cursor.resultCount);
console.log("收录数量:"+sietnums);
}
});
}

Related Posts: Greasemonkey使用谷歌搜索API获取搜索结果 :