1234567891011121314151617181920212223242526272829303132 |
- from abc import ABC, abstractmethod
- # 策略
- class Strategy(ABC):
- @abstractmethod
- def crawl(self):
- pass
- # TODO 不同平台 不同策略
- class XiaoniangaoHomePageStrategy(Strategy):
- def crawl(self):
- # 具体逻辑
- print("XiaoniangaoHomePageStrategy")
- return
- class XiguaHomePageStrategy(Strategy):
- def crawl(self):
- # 具体逻辑
- print("XiguaHomePageStrategy")
- return
- class ShipinhaoHomePageStrategy(Strategy):
- def crawl(self):
- # 具体逻辑
- print("ShipinhaoHomePageStrategy")
- return
|