From e69df2ebb6c57f244c9ac8af3131ed7bbbbc6cd6 Mon Sep 17 00:00:00 2001 From: mzl Date: Sat, 10 Jan 2026 21:36:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E6=9E=90=E8=B4=A6=E5=8F=B7&Excel?= =?UTF-8?q?=E5=AF=BC=E5=85=A5&=E5=AE=9E=E6=97=B6=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xhs_crawler_core.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/xhs_crawler_core.py b/xhs_crawler_core.py index 21eb0d8..23eb01d 100644 --- a/xhs_crawler_core.py +++ b/xhs_crawler_core.py @@ -602,12 +602,21 @@ def resolve_profile_by_search( continue score = 0 + # 精确匹配小红书号:最高优先级 if xhs_no and xhs_no.lower() == kw.lower(): - score += 100 - if nickname and kw in nickname: - score += 10 + score += 1000 + # 精确匹配昵称:高优先级 + elif nickname and nickname.lower() == kw.lower(): + score += 500 + # 昵称包含关键词:中优先级 + elif nickname and kw.lower() in nickname.lower(): + score += 50 + # URL 中包含关键词:低优先级 + if kw.lower() in href.lower(): + score += 20 + # 有有效的 profile ID:基础分 if _extract_profile_id_from_href(href): - score += 1 + score += 5 if score > best_score: best_score = score