This commit is contained in:
HuangHai
2026-01-14 07:28:06 +08:00
parent 4cc6bc06d1
commit af60249fce
19 changed files with 166 additions and 28 deletions

View File

@@ -4,7 +4,7 @@ import logging
import os
import sys
import time
from Apps.TelaiDian.Kit import take_screenshot, get_image_content_md5, clean_station_name
from Apps.TelaiDian.Kit import take_screenshot, get_image_content_md5, clean_station_name, setup_logger
from Apps.TelaiDian.ReadImageKit import ReadImageKit
from Apps.TelaiDian.Service import TelaiDianService
from Apps.TelaiDian.Config.Setting import (
@@ -20,8 +20,8 @@ project_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(_
if project_root not in sys.path:
sys.path.append(project_root)
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger("TelaiDianCrawler")
# 初始化日志
logger = setup_logger("TelaiDianCrawler")
class TelaiDianCrawler(BaseCrawler):
def __init__(self, service=None):
@@ -119,6 +119,20 @@ class TelaiDianCrawler(BaseCrawler):
if os.path.exists(screenshot_path): os.remove(screenshot_path)
async def crawl_list(self):
"""
实现 BaseCrawler 的抽象方法
"""
d = u2.connect()
await self.crawl_list_logic(d)
async def crawl_detail(self, station_info):
"""
实现 BaseCrawler 的抽象方法
"""
# 逻辑已在 crawl_list_logic 中通过 crawl_detail_logic 调用
pass
async def main(service=None):
crawler = TelaiDianCrawler(service=service)
await crawler.start()