Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

fix: cookies setting in preNavigationHooks (#1283)

Andrey Bykov178d6e311b4c
diff --git a/src/crawlers/crawler_utils.js b/src/crawlers/crawler_utils.js
index 3e946495d..24b03e038 100644
--- a/src/crawlers/crawler_utils.js
+++ b/src/crawlers/crawler_utils.js
@@ -46,7 +46,7 @@ export function mergeCookies(url, sourceCookies) {
// ignore empty cookies
for (const sourceCookieString of sourceCookies.filter((c) => c)) {
- const cookies = sourceCookieString.split(/ *; */); // ignore extra spaces
+ const cookies = sourceCookieString.split(/ *; */).filter((c) => c); // ignore extra spaces
for (const cookieString of cookies) {
const cookie = Cookie.parse(cookieString);