So I have made a Scrapy Splash request like this:
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},)
The problems is how do I get the cookies that I've set to be returned using the lua script?
Found the answer! Access it at response.cookiejar
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.