如何做搜尋引擎蜘蛛日誌分析
搜尋引擎蜘蛛日誌檔案是一種非常強大但未被站長充分利用的檔案,分析它可以獲取有關每個搜尋引擎如何爬取網站內容的相關資訊點,及檢視搜尋引擎蜘蛛在一段時間內的行為。
| IP地址(2) | 伺服器名稱 | 所屬國家 |
|---|---|---|
| 195.154.133.41 | 195-154-133-41.rev.poneytelecom.eu | FR |
| 52.59.102.78 | ec2-52-59-102-78.eu-central-1.compute.amazonaws.com | DE |
| IP地址(2) | 伺服器名稱 | 所屬國家 |
|---|---|---|
| 3.127.119.2 | ec2-3-127-119-2.eu-central-1.compute.amazonaws.com | DE |
| 62.138.3.191 | astra4433.startdedicated.de | FR |
| IP地址(1) | 伺服器名稱 | 所屬國家 |
|---|---|---|
| 104.207.143.191 | ? | US |
| IP地址(3) | 伺服器名稱 | 所屬國家 |
|---|---|---|
| 212.251.196.81 | ? | NO |
| 84.202.187.83 | ? | NO |
| 95.34.60.49 | 49.60.34.95.customer.cdi.no | NO |
通常不需要。除非您不希望資訊流網站或者APP對您的網站內容進行抓取,網站也不提供Feed訂閱服務,則可以考慮攔截此型別爬蟲。
您可以通過在網站的 robots.txt 中設定使用者代理訪問規則來遮蔽 VIPnytt bot 或限制其訪問許可權。我們建議安裝 Spider Analyser 外掛,以檢查它是否真正遵循這些規則。
# robots.txt # 下列程式碼一般情況可以攔截該代理 User-agent: VIPnytt bot Disallow: /
您無需手動執行此操作,可通過我們的 Wordpress 外掛 Spider Analyser 來攔截不必要的蜘蛛或者爬蟲。
一個易於使用、可擴充套件的 robots.txt 解析器庫,完全支援網際網路上的所有指令和規範。
用例:
robots.txt 渲染(與大多數其他 robots.txt 庫相比)
robots.txt 。(可選)User-Agent分析器和組確定器庫,以獲得最大的準確性。要求:
The recommended way to install the robots.txt parser is through Composer. Add this to your composer.json file:
安裝 robots.txt 解析器的推薦方式是通過 Composer。在你的 composer.json檔案中加入以下內容。
{
"require": {
"vipnytt/robotstxtparser": "^2.1"
}
}
然後執行: php composer update
<?php
$client = new vipnytt\RobotsTxtParser\UriClient('http://example.com');
if ($client->userAgent('MyBot')->isAllowed('http://example.com/somepage.html')) {
// Access is granted
}
if ($client->userAgent('MyBot')->isDisallowed('http://example.com/admin')) {
// Access is denied
}
<?php
// Syntax: $baseUri, [$statusCode:int|null], [$robotsTxtContent:string], [$encoding:string], [$byteLimit:int|null]
$client = new vipnytt\RobotsTxtParser\TxtClient('http://example.com', 200, $robotsTxtContent);
// Permission checks
$allowed = $client->userAgent('MyBot')->isAllowed('http://example.com/somepage.html'); // bool
$denied = $client->userAgent('MyBot')->isDisallowed('http://example.com/admin'); // bool
// Crawl delay rules
$crawlDelay = $client->userAgent('MyBot')->crawlDelay()->getValue(); // float | int
// Dynamic URL parameters
$cleanParam = $client->cleanParam()->export(); // array
// Preferred host
$host = $client->host()->export(); // string | null
$host = $client->host()->getWithUriFallback(); // string
$host = $client->host()->isPreferred(); // bool
// XML Sitemap locations
$host = $client->sitemap()->export(); // array
以上只是一個基本的嘗試,還有一大堆更高階和/或專門的方法,幾乎可以用於任何目的。請訪問小抄以瞭解技術細節。
請訪問文件以瞭解更多資訊。