fix: Update crawler.ts to log cookies

This commit is contained in:
Harsh Gupta 2024-08-15 22:43:49 +05:30 committed by Harsh Gupta (aider)
parent 1a5f2eb408
commit dcc3e5294d

View File

@ -877,7 +877,7 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`;
this.threadLocal.set('timeout', opts.timeout * 1000); this.threadLocal.set('timeout', opts.timeout * 1000);
} }
const cookies = req.headers['x-set-cookie'] ? const cookies = req.headers['x-set-cookie'] ?
(Array.isArray(req.headers['x-set-cookie']) ? req.headers['x-set-cookie'] : [req.headers['x-set-cookie']]) (Array.isArray(req.headers['x-set-cookie']) ? req.headers['x-set-cookie'] : [req.headers['x-set-cookie']])
.map(cookie => { .map(cookie => {
const [name, value] = cookie.split('='); const [name, value] = cookie.split('=');
@ -885,6 +885,7 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`;
}) })
: []; : [];
console.log('Cookies:', cookies);
const crawlOpts: ExtraScrappingOptions = { const crawlOpts: ExtraScrappingOptions = {
proxyUrl: opts.proxyUrl, proxyUrl: opts.proxyUrl,
cookies: cookies, cookies: cookies,