Cookies are key-value pairs stored by the browser and sent with every subsequent request to the same domain. Websites use them to maintain login sessions, persist user preferences, and store anti-bot clearance tokens. A scraper that ignores cookies will be treated as a new, unauthenticated visitor on every request.
Effective cookie handling involves initialising a cookie jar, persisting cookies across requests, respecting cookie attributes (domain, path, secure, httpOnly, SameSite), and refreshing cookies that expire. For anti-bot systems, the clearance cookie obtained after solving a challenge must be included in all subsequent requests or the bot check restarts.
Browser-based scrapers inherit the browser's native cookie store, making cookie handling transparent. HTTP-based scrapers must explicitly manage cookies using a session object (Python `requests.Session`) or a cookie jar library. Some sites also set cookies via JavaScript (`document.cookie`), which requires a browser to execute.