'commit'
This commit is contained in:
@@ -244,6 +244,7 @@ class TeLaiDianCrawler(BaseCrawler):
|
|||||||
template_jgxx = os.path.join(os.path.dirname(__file__), "Template", "jgxx.jpg")
|
template_jgxx = os.path.join(os.path.dirname(__file__), "Template", "jgxx.jpg")
|
||||||
template_qbsd = os.path.join(os.path.dirname(__file__), "Template", "qbsd.jpg")
|
template_qbsd = os.path.join(os.path.dirname(__file__), "Template", "qbsd.jpg")
|
||||||
entrance_point = None
|
entrance_point = None
|
||||||
|
entrance_source = None
|
||||||
max_search_rounds = 5
|
max_search_rounds = 5
|
||||||
|
|
||||||
if os.path.exists(template_qbsd):
|
if os.path.exists(template_qbsd):
|
||||||
@@ -264,6 +265,7 @@ class TeLaiDianCrawler(BaseCrawler):
|
|||||||
elif isinstance(match_res_qbsd, (list, tuple)) and len(match_res_qbsd) >= 2:
|
elif isinstance(match_res_qbsd, (list, tuple)) and len(match_res_qbsd) >= 2:
|
||||||
entrance_point = (match_res_qbsd[0], match_res_qbsd[1])
|
entrance_point = (match_res_qbsd[0], match_res_qbsd[1])
|
||||||
if entrance_point:
|
if entrance_point:
|
||||||
|
entrance_source = "qbsd"
|
||||||
logger.info(f"[详情页] 通过 qbsd.jpg 成功找到价格入口: {entrance_point}")
|
logger.info(f"[详情页] 通过 qbsd.jpg 成功找到价格入口: {entrance_point}")
|
||||||
|
|
||||||
for round_idx in range(max_search_rounds):
|
for round_idx in range(max_search_rounds):
|
||||||
@@ -289,6 +291,8 @@ class TeLaiDianCrawler(BaseCrawler):
|
|||||||
entrance_point = (match_res["x"], match_res["y"])
|
entrance_point = (match_res["x"], match_res["y"])
|
||||||
elif isinstance(match_res, (list, tuple)) and len(match_res) >= 2:
|
elif isinstance(match_res, (list, tuple)) and len(match_res) >= 2:
|
||||||
entrance_point = (match_res[0], match_res[1])
|
entrance_point = (match_res[0], match_res[1])
|
||||||
|
if entrance_point and not entrance_source:
|
||||||
|
entrance_source = "jgxx"
|
||||||
|
|
||||||
if not entrance_point:
|
if not entrance_point:
|
||||||
try:
|
try:
|
||||||
@@ -306,6 +310,7 @@ class TeLaiDianCrawler(BaseCrawler):
|
|||||||
if vy > int(h * (1 - BOTTOM_SAFE_EXCLUDE_RATIO)):
|
if vy > int(h * (1 - BOTTOM_SAFE_EXCLUDE_RATIO)):
|
||||||
vy = int(h * (1 - BOTTOM_SAFE_EXCLUDE_RATIO))
|
vy = int(h * (1 - BOTTOM_SAFE_EXCLUDE_RATIO))
|
||||||
entrance_point = (vx, vy)
|
entrance_point = (vx, vy)
|
||||||
|
entrance_source = entrance_source or "vlm"
|
||||||
logger.info(f"[详情页] VLM 成功找到价格入口: {entrance_point},原因: {vlm_res.get('reason')}")
|
logger.info(f"[详情页] VLM 成功找到价格入口: {entrance_point},原因: {vlm_res.get('reason')}")
|
||||||
|
|
||||||
if entrance_point:
|
if entrance_point:
|
||||||
@@ -330,7 +335,7 @@ class TeLaiDianCrawler(BaseCrawler):
|
|||||||
click_x = ex
|
click_x = ex
|
||||||
offset_y = int(h * 0.1)
|
offset_y = int(h * 0.1)
|
||||||
click_y = min(h - 10, ey + offset_y)
|
click_y = min(h - 10, ey + offset_y)
|
||||||
logger.info(f"[详情页] 通过 jgxx.jpg 成功找到价格入口,模板中心: ({ex}, {ey}),调整后点击坐标: ({click_x}, {click_y}),即将进入电价页")
|
logger.info(f"[详情页] 使用 {entrance_source or '模板'} 价格入口坐标: ({ex}, {ey}),调整后点击坐标: ({click_x}, {click_y}),即将进入电价页")
|
||||||
d.click(click_x, click_y)
|
d.click(click_x, click_y)
|
||||||
await asyncio.sleep(WAIT_DETAIL_PAGE_LOAD)
|
await asyncio.sleep(WAIT_DETAIL_PAGE_LOAD)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user