'commit'
This commit is contained in:
@@ -28,9 +28,8 @@ from Config.Config import (
|
||||
)
|
||||
from Apps.XinDianTu.Config.Setting import (
|
||||
SCROLL_DISTANCE_RATIO,
|
||||
MAX_SCROLLS, REDIS_STATION_EXPIRE,
|
||||
MAX_STATIONS_COUNT, REDIS_STATION_EXPIRE,
|
||||
WAIT_DETAIL_PAGE_LOAD, WAIT_BACK_TO_LIST, WAIT_AFTER_SCROLL,
|
||||
MAX_CRAWL_DISTANCE,
|
||||
SAFE_EXCLUDE_RATIO,
|
||||
BOTTOM_SAFE_EXCLUDE_RATIO
|
||||
)
|
||||
@@ -73,7 +72,7 @@ class XinDianTuCrawler(BaseCrawler):
|
||||
def __init__(self, service=None):
|
||||
super().__init__(service)
|
||||
# 初始化配置参数
|
||||
self.max_scrolls = MAX_SCROLLS
|
||||
self.max_stations_count = MAX_STATIONS_COUNT
|
||||
self.uploader = ObsUploader()
|
||||
self.redis_kit = RedisKit()
|
||||
|
||||
@@ -139,7 +138,7 @@ async def analyze_prices_background(service, station_name, image_paths, device_i
|
||||
return True
|
||||
|
||||
|
||||
async def get_station_list(d, service, uploader, max_scrolls=MAX_SCROLLS):
|
||||
async def get_station_list(d, service, uploader, max_stations_count=MAX_STATIONS_COUNT):
|
||||
"""
|
||||
获取场站列表并处理翻页 (异步优化版)
|
||||
"""
|
||||
@@ -151,14 +150,17 @@ async def get_station_list(d, service, uploader, max_scrolls=MAX_SCROLLS):
|
||||
device_info['width'] = w
|
||||
device_info['height'] = h
|
||||
|
||||
logger.info(f"开始爬取列表,设备: {device_info.get('productName')} | 分辨率: {w}x{h}")
|
||||
logger.info(f"开始爬取列表,设备: {device_info.get('productName')} | 分辨率: {w}x{h} | 目标数量: {max_stations_count}")
|
||||
|
||||
background_tasks = []
|
||||
last_list_md5 = None
|
||||
no_new_data_count = 0
|
||||
total_processed_count = 0
|
||||
scroll_count = 0
|
||||
|
||||
for i in range(max_scrolls + 1):
|
||||
logger.info(f"正在处理第 {i + 1} 页...")
|
||||
while total_processed_count < max_stations_count:
|
||||
scroll_count += 1
|
||||
logger.info(f"正在处理第 {scroll_count} 次滚动 (已采集: {total_processed_count}/{max_stations_count})...")
|
||||
|
||||
# 1. 拍摄截图
|
||||
image_uuid = str(uuid.uuid4())
|
||||
|
||||
Reference in New Issue
Block a user