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

Created a new hook called "on_page_created" which allows the user to inspect raw HTTP requests/responses, and more #109

Closed
wants to merge 1 commit into from

Conversation

ifaddict1
Copy link

Dears, while using your library, I needed to access the raw content of requests being sent when a page is crawled (for instance, requests made to other APIs or files, etc.), the responses, and the associated headers. I realized that the easiest way to do this would be to leverage the existing Playwright hook on "Page" objects by using "Page.on()". Thus, I added a hook in the AsyncCrawlerStragegy class to achieve that.

Please let me know if this is actually useless and there is an easier/native way to do this with your library, but I haven't found any.

Cheers

…modify the page object and, for instance, leverage native Playwright hooks to inspect requests and responses.
@oscarnevarezleal
Copy link

I'd love to see this implemented. I'm also intending of reading http requests made by the page.

@aravindkarnam
Copy link
Collaborator

aravindkarnam commented Jan 22, 2025

@ifaddict1 Again thanks for this wonderful PR, and it adds a really nice feature too. I just reviewed it, and found that there has been so many changes and refactors since you raised your PR.

I see that you have set the hook to execute immediately after context.new_page(). However if you visit the async_crawler_strategy now, you can see that that newly managed browsers have been introduced and there's a new get_page function which refactors the complexity of page creation.

So I'm afraid we will not be able to merge this PR as it is. But the feature request is still relevant, so I created this discussion here.

Going forward I encourage you to create feature requests first(rather than directly raising a PR), so that maintainers and community members have visibility to figure out where it fits in the roadmap, to plan, collaborate and release.

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.

5 participants