Skip to content

🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev

style(spiders): make parse function abstract

Karim shoair02c9dffc7700
diff --git a/scrapling/spiders/spider.py b/scrapling/spiders/spider.py
index ac7174f..aedab1a 100644
--- a/scrapling/spiders/spider.py
+++ b/scrapling/spiders/spider.py
@@ -1,6 +1,6 @@
import logging
-from abc import ABC
from pathlib import Path
+from abc import ABC, abstractmethod
import anyio
@@ -139,6 +139,7 @@ class Spider(ABC):
for url in self.start_urls:
yield Request(url, sid=self._session_manager.default_session_id)
+ @abstractmethod
async def parse(self, response: "Response") -> AsyncGenerator[Dict[str, Any] | Request | None, None]:
"""Default callback for processing responses"""
raise NotImplementedError(f"{self.__class__.__name__} must implement parse() method")