'commit'
This commit is contained in:
@@ -242,10 +242,33 @@ class TeLaiDianCrawler(BaseCrawler):
|
|||||||
await asyncio.sleep(1.0)
|
await asyncio.sleep(1.0)
|
||||||
|
|
||||||
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")
|
||||||
entrance_point = None
|
entrance_point = None
|
||||||
max_search_rounds = 5
|
max_search_rounds = 5
|
||||||
|
|
||||||
|
if os.path.exists(template_qbsd):
|
||||||
|
try:
|
||||||
|
match_res_qbsd = d.image.match(template_qbsd)
|
||||||
|
except Exception as e:
|
||||||
|
match_res_qbsd = None
|
||||||
|
logger.error(f"[详情页] qbsd 模板匹配价格入口失败: {e}")
|
||||||
|
if match_res_qbsd:
|
||||||
|
logger.info(f"[详情页] qbsd 模板匹配返回结果: {match_res_qbsd}")
|
||||||
|
if hasattr(match_res_qbsd, "point") and match_res_qbsd.point:
|
||||||
|
entrance_point = match_res_qbsd.point
|
||||||
|
elif isinstance(match_res_qbsd, dict):
|
||||||
|
if "point" in match_res_qbsd and match_res_qbsd["point"]:
|
||||||
|
entrance_point = match_res_qbsd["point"]
|
||||||
|
elif "x" in match_res_qbsd and "y" in match_res_qbsd:
|
||||||
|
entrance_point = (match_res_qbsd["x"], match_res_qbsd["y"])
|
||||||
|
elif isinstance(match_res_qbsd, (list, tuple)) and len(match_res_qbsd) >= 2:
|
||||||
|
entrance_point = (match_res_qbsd[0], match_res_qbsd[1])
|
||||||
|
if 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):
|
||||||
|
if entrance_point:
|
||||||
|
break
|
||||||
search_screen_path = take_screenshot(d, f"tld_detail_search_{int(time.time())}_{round_idx}.jpg")
|
search_screen_path = take_screenshot(d, f"tld_detail_search_{int(time.time())}_{round_idx}.jpg")
|
||||||
logger.info(f"[详情页] 搜索价格入口,第 {round_idx + 1}/{max_search_rounds} 轮: {search_screen_path}")
|
logger.info(f"[详情页] 搜索价格入口,第 {round_idx + 1}/{max_search_rounds} 轮: {search_screen_path}")
|
||||||
|
|
||||||
|
|||||||
BIN
Apps/TeLaiDian/Template/qbsd.jpg
Normal file
BIN
Apps/TeLaiDian/Template/qbsd.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Reference in New Issue
Block a user