title: Scrapy: How to get cookies from splash
body: <p>I am trying to get the cookies from a splash request, but I keep getting an error.</p>
  
  <p>Here is the code I am using:</p>
  
  <pre><code>class P2PEye(scrapy.Spider):
      name = 'p2peyeSpider'
      allowed_domains = ['p2peye.com']
      start_urls = ['https://www.p2peye.com/platform/h9/']
  
      def start_requests(self):
          script = '''
          function main(splash)
            local url = splash.args.url
            assert(splash:go(url))
            assert(splash:wait(0.5))
            return {
              cookies = splash:get_cookies(),
            }
          end
          '''
          for url in self.start_urls:
              yield SplashRequest(url, callback=self.parse, endpoint='render.html',args={'wait': 1, 'lua_source': script})
  
      def parse(self, response):
          print(response.request.headers.getlist('Set-Cookie'))
          print(response.cookiejar)
  </code></pre>
  
  <p>This is my <code>settings.py</code></p>
  
  <pre><code>SPLASH_URL = 'http://127.0.0.1:8050'
  CRAWLERA_ENABLED= False
  DOWNLOADER_MIDDLEWARES = {
      'scrapy_splash.SplashCookiesMiddleware': 723,
      'scrapy_splash.SplashMiddleware': 725,
      'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware': 810,
  }
  SPIDER_MIDDLEWARES = {'scrapy_splash.SplashDeduplicateArgsMiddleware': 100 }
  DUPEFILTER_CLASS = 'scrapy_splash.SplashAwareDupeFilter'
  HTTPCACHE_STORAGE = 'scrapy_splash.SplashAwareFSCacheStorage'
  COOKIES_ENABLED = True
  COOKIES_DEBUG = True
  SPLASH_COOKIES_DEBUG = True
  </code></pre>
  
  <p>The result of <code>response.request.headers.getlist('Set-Cookie')</code> is <code>[]</code>,
  and <code>response.cookiejar</code> got an error: <code>AttributeError: 'SplashTextResponse' object has no attribute 'cookiejar'</code>.
  So how can I get the cookies without causing an error?</p>