admin管理员组文章数量:1321250
I've been using crawlee for python recently to build reliable web scrapers, but sometimes I needed to execute some code before visiting the page url like:
- blocking specific resources (ex: imaged, media, etc)
- passing the created page to
playwright-stealth
like this:await stealth_async(page)
I searched the Docs for a parameter or a class with a similar functionality & found that PlaywrightCrawler
has a param called pre_navigation_hook
. However, I couldn't find how to use it or a tutorial on their site demonstrating that.
Please provide an example how to use it or any other way to achieve the points above.
Note: pre_navigation_hook
accepts a PlaywrightPreNavCrawlingContext
as mentioned in docs not PlaywrightCrawlingContext
like almost all other request_handler
s if this makes any hint.
本文标签: pythonHow to implement prenavigationhook of PlaywrightCrawler in crawlee pyStack Overflow
版权声明:本文标题:python - How to implement pre_navigation_hook of PlaywrightCrawler in crawlee py? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742092566a2420355.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论