便宜做網(wǎng)站,不用客戶動手特價999元,源碼整套僅需50元起

國內(nèi)外各個搜索蜘蛛爬蟲User-Agent,以及封禁的辦法匯總
國內(nèi)外有很多的網(wǎng)絡(luò)蜘蛛爬蟲,他們在進行爬行的時候會攜帶自己的user-agent,我們可以通過這個來判斷蜘蛛,從而限制蜘蛛對于網(wǎng)站的抓取。而同時也可以用robots.txt文件來對這些蜘蛛進行限制。
先來看看國內(nèi)外搜索蜘蛛的user-agent吧:
一、國外爬蟲的User-Agent:
1、谷歌:
Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html)
Mozilla/5.0+(Linux;+Android+6.0.1;+Nexus+5X+Build/MMB29P)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/99.0.4844.84+Mobile+Safari/537.36+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html)
Googlebot-Image/1.0【谷歌圖片】
2、bing
Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)
2、AhrefsBot:
Mozilla/5.0+(compatible;+AhrefsBot/7.0;++http://ahrefs.com/robot/)
3、SemrushBot:
Mozilla/5.0+(compatible;+SemrushBot/7~bl;++http://www.semrush.com/bot.html)
4、DotBot:
Mozilla/5.0+(compatible;+DotBot/1.2;++https://opensiteexplorer.org/dotbot;+help@moz.com)
5、Barkrowler:
Mozilla/5.0+(compatible;+Barkrowler/0.9;++https://babbar.tech/crawler)
二、國內(nèi)蜘蛛爬蟲的User-Agent:
1、百度:
Mozilla/5.0+(iPhone;+CPU+iPhone+OS+9_1+like+Mac+OS+X)+AppleWebKit/601.1.46+(KHTML,+like+Gecko)+Version/9.0+Mobile/13B143+Safari/601.1+(compatible;+Baiduspider-render/2.0;++http://www.baidu.com/search/spider.html)
2、搜狗搜索
Sogou+web+spider/4.0(+http://www.sogou.com/docs/help/webmasters.htm#07)
3、神馬搜索
Mozilla/5.0+(Windows+NT+6.1;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/69.0.3497.81+YisouSpider/5.0+Safari/537.36
4、頭條搜索:
Mozilla/5.0+(Linux;+Android+5.0)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Mobile+Safari/537.36+(compatible;+Bytespider;+https://zhanzhang.toutiao.com/)
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0);
5、360搜索
Mozilla/5.0 (Linux; U; Android 4.0.2; en-us; Galaxy Nexus Build/ICL53F) AppleWebKit/534.30 (KHTML, like Gecko)Version/4.0 Mobile Safari/534.30; 360Spider
Mozilla/5.0 (Linux; U; Android 4.0.2; en-us; Galaxy Nexus Build/ICL53F) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30; HaosouSpider
您可以通過程序或者服務(wù)器判斷user-agent來封禁這些蜘蛛。但這種辦法肯定也是需要消耗一定的服務(wù)器資源,因為在他們抓取的時候,對內(nèi)容進行封鎖,就會難一些。但對于向不同蜘蛛展示不同內(nèi)容,就可以用程序的方法來做。
用robots.txt來怎么封禁蜘蛛呢,我們寫了一個,供大家參考:
User-agent: MJ12bot
Disallow: /
User-agent: SemrushBot
Disallow: /
User-agent: SemrushBot-SA
Disallow: /
User-agent: SemrushBot-BA
Disallow: /
User-agent: SemrushBot-SI
Disallow: /
User-agent: SemrushBot-SWA
Disallow: /
User-agent: SemrushBot-CT
Disallow: /
User-agent: SemrushBot-BM
Disallow: /
User-agent: SemrushBot-SEOAB
Disallow: /
user-agent: AhrefsBot
Disallow: /
User-agent: DotBot
Disallow: /
User-agent: Uptimebot
Disallow: /
User-agent: MegaIndex.ru
Disallow: /
User-agent: ZoominfoBot
Disallow: /
User-agent: Mail.Ru
Disallow: /
User-agent: BLEXBot
Disallow: /
User-agent: ExtLinksBot
Disallow: /
User-agent: aiHitBot
Disallow: /
User-agent: Researchscan
Disallow: /
User-agent: DnyzBot
Disallow: /
User-agent: spbot
Disallow: /
User-agent: YandexBot
Disallow: /
User-agent: Barkrowler
Disallow: /
以上是封禁國外的幾個流氓蜘蛛的代碼,并沒有封禁像谷歌,bing等搜索引擎,是因為國內(nèi)有部分用戶是使用這些搜索引擎的。而且谷歌影響力比較大,還是希望它能夠抓取。
User-agent: Googlebot
User-agent: Baiduspider
User-agent: MSNBot
User-agent: Baiduspider-image
User-agent: YoudaoBot
User-agent: Sogou web spider
User-agent: Sogou inst spider
User-agent: Sogou spider2
User-agent: Sogou blog
User-agent: Sogou News Spider
User-agent: Sogou Orion spider
User-agent: ChinasoSpider
User-agent: Sosospider
User-agent: Yisouspider
User-agent: EasouSpider

本文作者:野狼SEO團隊

十六年網(wǎng)站建設(shè)相關(guān)經(jīng)驗
一站式為您提供網(wǎng)站相關(guān)服務(wù)
歡迎掃碼咨詢
還沒有人評論,快來搶個沙發(fā)!