Three ways of adding cookie by scratch

Settings

, 1. Settings
Settings file annotation Cookies_enabled=False.
Settings cookie is the easiest to configure.
the cookie added in the latter two methods is in dictionary format and needs to be deserialized with json,
and set Cookies_enabled=True

in Settings
Go to the middleware file and find the class DownloadMiddleware. Change process_request and add request.cookies={}.

3. Rewrite start_request

in the crawler main file

def start_requests(self):
    yield scrapy.Request(url,dont_filter=True,cookies={自己的cookie})

Read More: