feat: add hook to run after collecting an item

This commit is contained in:
Karim shoair
2026-01-12 15:58:33 +02:00
parent e0f94cf7d0
commit 3466bcab2c
2 changed files with 7 additions and 6 deletions
+4
View File
@@ -158,6 +158,10 @@ class Spider(ABC):
"""
self.logger.error(error, exc_info=error)
async def on_scraped_item(self, item: dict[str, Any]) -> None:
"""Handle a scraped item. Override or extend for item pipelines."""
pass
async def is_blocked(self, response: "Response") -> bool:
"""Check if the response is blocked. Users should override this for custom detection logic."""
if response.status in BLOCKED_CODES: