所以我做了一个像这样的Scrapy Splash请求:
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?
答案 0 :(得分:2)
找到答案!在response.cookiejar