Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly set cookies #185

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

ZephyrZenn
Copy link

@ZephyrZenn ZephyrZenn commented Jan 15, 2025

PR Description

Summary

This pull request introduces the changes to crawl function. This fix the problem that crawler can't get cookies correctly.

Changes Made

  1. Update PlaywrightCrawler.preNavigationHooks in crawl function(core.ts)
    • setting cookies before return if RESOURCE_EXCLUSIONS is empty. Otherwise cookies won't be set if no url excluded.
    • Use request.url instead of request.loadedUrl as cookie's url. Crawler hasn't naviagetd to the page when the hook invoked, so the loadedUrl would always be undefined.

Impact

Crawler can use cookies correctly when there is no excluded urls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant