我有一堆目前在Google上编入索引的网址。鉴于这些网址,有没有办法弄清楚谷歌最后一次抓取它们的时间?
手动,如果我查看Google中的链接并查看“缓存”链接,我会看到抓取时的日期。有没有办法自动执行此操作?某种Google API?
谢谢:)
答案 0 :(得分:3)
Google不会为此类数据提供API。跟踪上次抓取信息的最佳方法是挖掘服务器日志。
在您的服务器日志中,您应该能够识别Googlebot的典型用户代理:Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html)
。然后,您可以查看Googlebot已抓取的网址以及何时抓取。
如果您想确定Googlebot是否可以抓取这些网页verify it with a Reverse DNS lookup.。 Bingbot还支持反向DNS查找。
如果您不想手动解析服务器日志,则可以始终使用splunk或logstash之类的内容。两者都是很棒的日志处理平台。
另请注意,SERP中的“缓存”日期并不总是与上次爬网日期匹配。 Googlebot可以在“缓存”日期之后多次抓取您的网页,但不会更新其缓存版本。您可以将“缓存日期”视为“最后编入索引”日期的更多内容,但这也不完全正确。在任何一种情况下,如果您需要重新编制索引页面,则可以始终使用Google网站站长工具(GWT)。 GWT中有一个选项可以强制Googlebot重新抓取页面,还可以重新索引页面。每周限制为50或类似的东西。
答案 1 :(得分:1)
您可以使用链接http://www.gbotvisit.com/
查看google bot上次访问答案 2 :(得分:1)
<?php
$domain_name = $_GET["url"];
//get googlebot last access
function googlebot_lastaccess($domain_name)
{
$request = 'http://webcache.googleusercontent.com/search?hl=en&q=cache:'.$domain_name.'&btnG=Google+Search&meta=';
$data = getPageData($request);
$spl=explode("as it appeared on",$data);
//echo "<pre>".$spl[0]."</pre>";
$spl2=explode(".<br>",$spl[1]);
$value=trim($spl2[0]);
//echo "<pre>".$spl2[0]."</pre>";
if(strlen($value)==0)
{
return(0);
}
else
{
return($value);
}
}
$content = googlebot_lastaccess($domain_name);
$date = substr($content , 0, strpos($content, 'GMT') + strlen('GMT'));
echo "Googlebot last access = ".$date."<br />";
function getPageData($url) {
if(function_exists('curl_init')) {
$ch = curl_init($url); // initialize curl with given url
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // add useragent
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // write the response to a variable
if((ini_get('open_basedir') == '') && (ini_get('safe_mode') == 'Off')) {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // follow redirects if any
}
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); // max. seconds to execute
curl_setopt($ch, CURLOPT_FAILONERROR, 1); // stop when it encounters an error
return @curl_exec($ch);
}
else {
return @file_get_contents($url);
}
}
?>
只需上传此PHP并创建一个Cron-Job。 您可以将其测试为以下内容... / bot.php / url = http:// www ....