首页 文章

Web Crawler - 忽略Robots.txt文件?

提问于
浏览
11

某些服务器具有robots.txt文件,以阻止网络抓取工具抓取其网站 . 有没有办法让网络抓取工具忽略robots.txt文件?我正在使用Mechanize for python .

2 回答

  • 8

    机械化的documentation有以下示例代码:

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

    这正是你想要的 .

  • 28

    This看起来像你需要的:

    from mechanize import Browser
    br = Browser()
    
    # Ignore robots.txt
    br.set_handle_robots( False )
    

    但你知道你在做什么......

相关问题