feat: v0.0.3 - 分类逻辑优化
【post_type 分类优化】 - 有"出"、"售"、"卖" → 出售(deal) - 有"收"、"求"、"购"、"要" → 求购(want) - 有"确认"、"朋友"、"投诉" → 其他(normal) - else → 出售(deal) # 默认改为出售 【category 分类优化】 - 优先级:龙钞 > 马钞 > 蛇钞 > 其他 - 龙钞:含"龙"、"龙钞"、"小龙钞"、"钞王" - 马钞:含"马"、"马钞" - 蛇钞:含"蛇"、"蛇钞" - 其他:以上都不是 【历史数据清洗】 - 重新分类 1813 条 post_type - 重新分类全量 category 数据
This commit is contained in:
parent
1c0f74ccb6
commit
65162298c5
|
|
@ -166,21 +166,28 @@ class YichensTodaySpider(PaginationSpider):
|
||||||
if "标百" in title:
|
if "标百" in title:
|
||||||
special_types.append("标百")
|
special_types.append("标百")
|
||||||
|
|
||||||
post_type = "normal"
|
# post_type 分类逻辑:出售 > 求购 > 其他 > 默认出售
|
||||||
if title:
|
if title:
|
||||||
if any(c in title for c in ["出", "售", "卖", "兑"]):
|
if any(c in title for c in ["出", "售", "卖"]):
|
||||||
post_type = "deal"
|
post_type = "deal"
|
||||||
elif any(c in title for c in ["求", "收", "购"]):
|
elif any(c in title for c in ["收", "求", "购", "要"]):
|
||||||
post_type = "want"
|
post_type = "want"
|
||||||
|
elif any(c in title for c in ["确认", "朋友", "投诉"]):
|
||||||
|
post_type = "normal"
|
||||||
|
else:
|
||||||
|
post_type = "deal" # 默认出售
|
||||||
|
else:
|
||||||
|
post_type = "normal"
|
||||||
|
|
||||||
|
# category 分类逻辑(优先级:龙钞 > 马钞 > 蛇钞 > 其他)
|
||||||
category = "其他"
|
category = "其他"
|
||||||
if title:
|
if title:
|
||||||
if "龙钞" in title or "龙纪念" in title:
|
if any(c in title for c in ["龙", "龙钞", "小龙钞", "钞王"]):
|
||||||
category = "龙钞"
|
category = "龙钞"
|
||||||
elif "蛇钞" in title:
|
elif any(c in title for c in ["马", "马钞"]):
|
||||||
category = "蛇钞"
|
|
||||||
elif "马钞" in title:
|
|
||||||
category = "马钞"
|
category = "马钞"
|
||||||
|
elif any(c in title for c in ["蛇", "蛇钞"]):
|
||||||
|
category = "蛇钞"
|
||||||
|
|
||||||
# 从 postuserinfo div 的 <b> 标签提取用户名(跳过电话号码)
|
# 从 postuserinfo div 的 <b> 标签提取用户名(跳过电话号码)
|
||||||
if not author:
|
if not author:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue