Cra*_*cke 13 python robots.txt mechanize web-crawler
某些服务器具有robots.txt文件,以阻止网络抓取工具抓取其网站.有没有办法让网络抓取工具忽略robots.txt文件?我正在使用Mechanize for python.
Dav*_*nan 29
mechanize 的文档有以下示例代码:
br = mechanize.Browser()
....
# Ignore robots.txt. Do not do this without thought and consideration.
br.set_handle_robots(False)
Run Code Online (Sandbox Code Playgroud)
这正是你想要的.
这看起来像你需要的:
from mechanize import Browser
br = Browser()
# Ignore robots.txt
br.set_handle_robots( False )
Run Code Online (Sandbox Code Playgroud)
但你知道你在做什么......