ts
This commit is contained in:
+7
-1
@@ -560,6 +560,9 @@ def resolve_profile_by_search(
|
||||
m = re.search(r'小红书号[::]\s*([A-Za-z0-9]+)', full_text)
|
||||
if m:
|
||||
xhs_no = m.group(1).strip()
|
||||
_log(log, f"[调试{i+1}] 提取到小红书号: {xhs_no}")
|
||||
else:
|
||||
_log(log, f"[调试{i+1}] 未匹配到小红书号,文本前100字符: {full_text[:100]}")
|
||||
|
||||
# 提取昵称:从开头去除干扰信息
|
||||
lines = full_text.split('\n')
|
||||
@@ -578,7 +581,8 @@ def resolve_profile_by_search(
|
||||
nickname = re.sub(r'\s+', ' ', main_text).strip()
|
||||
else:
|
||||
nickname = full_text
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
_log(log, f"[调试{i+1}] 解析异常: {e}")
|
||||
nickname = ""
|
||||
xhs_no = ""
|
||||
else:
|
||||
@@ -603,9 +607,11 @@ def resolve_profile_by_search(
|
||||
# 精确匹配小红书号:最高优先级
|
||||
if xhs_no and xhs_no.lower() == kw.lower():
|
||||
score += 100
|
||||
_log(log, f"[调试{i+1}] 小红书号精确匹配!+100分")
|
||||
# 昵称包含关键词
|
||||
if nickname and kw in nickname:
|
||||
score += 10
|
||||
_log(log, f"[调试{i+1}] 昵称包含关键词!+10分")
|
||||
# 有有效的 profile ID
|
||||
if _extract_profile_id_from_href(href):
|
||||
score += 1
|
||||
|
||||
Reference in New Issue
Block a user