How to get cookie generated from a Scrapy Splash request?
因此我发出了一个Scrapy Splash请求,如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | def start_requests(self): lua_script = ''' function main(splash) local url = splash.args.url assert(splash:go(url)) assert(splash:wait(0.5)) return { cookies = splash:get_cookies(), } end ''' yield SplashRequest(self.start_urls[0], self.parse, endpoint='render.html', args={'wait': 1, 'lua_source': lua_script},) |
问题是如何使用lua脚本获取设置为返回的cookie?
找到了答案!通过
访问