python - 网络爬虫 - 忽略 Robots.txt 文件?

标签 python web-crawler mechanize robots.txt

一些服务器有一个 robots.txt 文件,以阻止网络爬虫在他们的网站上爬行。有没有办法让网络爬虫忽略 robots.txt 文件?我正在为 python 使用 Mechanize。

最佳答案

documentation对于 mechanize 有这个示例代码:

br = mechanize.Browser()
....
# Ignore robots.txt.  Do not do this without thought and consideration.
br.set_handle_robots(False)

这正是您想要的。

关于python - 网络爬虫 - 忽略 Robots.txt 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8386481/

相关文章:

python - 我可以让 JSON 加载到 OrderedDict 中吗?

python - 计算单词数组中相同的连续字母

web-crawler - 如何使用scrapy提取网站的链接图?

ruby-on-rails - (Rails) 无法让 Mechanize 正确读取 web xml 文件

python - 将 namedtuple 映射为字典

python - 如何以pythonic方式将元组一分为二

node.js - 在Nightmare.js中无法读取null的 'blur'属性

python - 如何在Python中使用Selenium连续抓取网页中的文章

python - Mechanize 未正确登录站点

perl - 如何可视化/美化打印 HTML DOM 树?