我正在努力尊重robots.txt文件,当我在网络上爬行时,我遇到了一些奇怪的事情。我要访问的robots.txt URL是:https://podatki.gov.si/robots.txt
如果我在Chrome中打开这个链接,我会得到这个链接:
User-agent: *
Disallow: /但是,如果我使用Internet或Selenium WebDriver (ChromeDriver)打开此链接,则会得到以下内容:
#
# robots.txt
#
# This file is to prevent the crawling and indexing of certain parts
# of your site by web crawlers and spiders run by sites like Yahoo!
# and Google. By telling these "robots" where not to go on your site,
# you save bandwidth and server resources.
#
# This file will be ignored unless it is at the root of your host:
# Used: http://example.com/robots.txt
# Ignored: http://example.com/site/robots.txt
#
# For more information about the robots.txt standard, see:
# http://www.robotstxt.org/robotstxt.html
User-agent: *
Crawl-delay: 10
# CSS, JS, Images
Allow: /misc/*.css$
Allow: /misc/*.css?
Allow: /misc/*.js$
Allow: /misc/*.js?
Allow: /misc/*.gif
Allow: /misc/*.jpg
Allow: /misc/*.jpeg
Allow: /misc/*.png
Allow: /modules/*.css$
Allow: /modules/*.css?
Allow: /modules/*.js$
Allow: /modules/*.js?
Allow: /modules/*.gif
Allow: /modules/*.jpg
Allow: /modules/*.jpeg
Allow: /modules/*.png
Allow: /profiles/*.css$
Allow: /profiles/*.css?
Allow: /profiles/*.js$
Allow: /profiles/*.js?
Allow: /profiles/*.gif
Allow: /profiles/*.jpg
Allow: /profiles/*.jpeg
Allow: /profiles/*.png
Allow: /themes/*.css$
Allow: /themes/*.css?
Allow: /themes/*.js$
Allow: /themes/*.js?
Allow: /themes/*.gif
Allow: /themes/*.jpg
Allow: /themes/*.jpeg
Allow: /themes/*.png
# Directories
Disallow: /includes/
Disallow: /misc/
Disallow: /modules/
Disallow: /profiles/
Disallow: /scripts/
Disallow: /themes/
# Files
Disallow: /CHANGELOG.txt
Disallow: /cron.php
Disallow: /INSTALL.mysql.txt
Disallow: /INSTALL.pgsql.txt
Disallow: /INSTALL.sqlite.txt
Disallow: /install.php
Disallow: /INSTALL.txt
Disallow: /LICENSE.txt
Disallow: /MAINTAINERS.txt
Disallow: /update.php
Disallow: /UPGRADE.txt
Disallow: /xmlrpc.php
# Paths (clean URLs)
Disallow: /admin/
Disallow: /comment/reply/
Disallow: /filter/tips/
Disallow: /node/add/
Disallow: /search/
Disallow: /user/register/
Disallow: /user/password/
Disallow: /user/login/
Disallow: /user/logout/
# Paths (no clean URLs)
Disallow: /?q=admin/
Disallow: /?q=comment/reply/
Disallow: /?q=filter/tips/
Disallow: /?q=node/add/
Disallow: /?q=search/
Disallow: /?q=user/password/
Disallow: /?q=user/register/
Disallow: /?q=user/login/
Disallow: /?q=user/logout/这一切为什么要发生?后者似乎是一个通用的robots.txt文件,也许是自动生成的?
发布于 2019-03-22 09:30:36
我观察到同样的行为如下:
https://podatki.gov.si/robots.txt时,我得到:
用户代理:*不允许:/robots.txt
根据robotstxt.org网站所有者使用robots.txt文件向网络机器人提供关于他们的网站的指示。这被称为--机器人排除协议。
它的工作如下:
http://www.example.com/welcome.html。- The **`User-agent: *`** means this section applies to all robots.
- The **`Disallow: /`** tells the robot that it should not visit any pages on the site.
在使用robots.txt时有两个重要的注意事项
robots.txt。特别是扫描网络安全漏洞的恶意软件机器人,以及垃圾邮件发送者使用的电子邮件地址收割机将不予注意。robots.txt文件是一个公开可用的文件。任何人都可以看到您不希望机器人使用的服务器中的哪些部分。欧特罗
由于使用ChromeDriver和Chrome,navigator.webdriver为合作用户代理定义了一种标准方式,用于通知文档由WebDriver控制,以便在自动化过程中触发备用代码路径。因此,您可以从robots.txt中看到更多的内容。
您可以在Selenium flag驱动程序:修改navigator.webdriver标志以防止硒检测中找到相关的讨论
https://stackoverflow.com/questions/55291206
复制相似问题