This commit is contained in:
HuangHai
2026-01-12 07:49:18 +08:00
commit b66f683dfb
2891 changed files with 21165 additions and 0 deletions

41
Core/BaseCrawler.py Normal file
View File

@@ -0,0 +1,41 @@
# coding=utf-8
import abc
import logging
class BaseCrawler(abc.ABC):
"""
所有小程序爬虫的基类。
定义了标准的生命周期方法。
"""
def __init__(self, service=None):
self.logger = logging.getLogger(self.__class__.__name__)
self.service = service
@abc.abstractmethod
async def start(self):
"""
启动爬虫的主入口。
"""
pass
@abc.abstractmethod
async def open_app(self):
"""
打开目标小程序。
"""
pass
@abc.abstractmethod
async def crawl_list(self):
"""
爬取列表页。
"""
pass
@abc.abstractmethod
async def crawl_detail(self, station_info):
"""
爬取详情页。
"""
pass