我用刮花来造我的蜘蛛。现在我需要的是维护会话,所以我使用scrapy.DownloaderMiddle软件.cookies.cookies中间件它处理set cookie头。我知道它处理set cookie头,因为我设置了COOKIES_DEBUG=True,这会导致CookeMiddleware打印出关于set cookie header的信息。在
问题是:当我还向图片添加Splash时,设置的cookie打印输出就会消失,实际上我得到的响应头是 {'Date':['Sun,2016年9月25日12:09:55 GMT'],'内容类型':['text/html;charset=utf-8'],'服务器':['TwistedWeb/16.1.1']} 与使用TwistedWeb的splash渲染引擎有关。在
有没有指令告诉splash也给我原始的响应头?在
要获得原始的响应头,可以编写一个Splash Lua script;请参阅scrapy splash自述中的examples:
scrapy splash还为cookie处理提供了built-in helpers;在本例中,只要scrapy splash是configured,如自述中所述。在
相关问题 更多 >
编程相关推荐