diff --git a/crawlers/crawl_today.py b/crawlers/crawl_today.py index 90bc784..8f41231 100644 --- a/crawlers/crawl_today.py +++ b/crawlers/crawl_today.py @@ -166,21 +166,28 @@ class YichensTodaySpider(PaginationSpider): if "标百" in title: special_types.append("标百") - post_type = "normal" + # post_type 分类逻辑:出售 > 求购 > 其他 > 默认出售 if title: - if any(c in title for c in ["出", "售", "卖", "兑"]): + if any(c in title for c in ["出", "售", "卖"]): post_type = "deal" - elif any(c in title for c in ["求", "收", "购"]): + elif any(c in title for c in ["收", "求", "购", "要"]): post_type = "want" + elif any(c in title for c in ["确认", "朋友", "投诉"]): + post_type = "normal" + else: + post_type = "deal" # 默认出售 + else: + post_type = "normal" + # category 分类逻辑(优先级:龙钞 > 马钞 > 蛇钞 > 其他) category = "其他" if title: - if "龙钞" in title or "龙纪念" in title: + if any(c in title for c in ["龙", "龙钞", "小龙钞", "钞王"]): category = "龙钞" - elif "蛇钞" in title: - category = "蛇钞" - elif "马钞" in title: + elif any(c in title for c in ["马", "马钞"]): category = "马钞" + elif any(c in title for c in ["蛇", "蛇钞"]): + category = "蛇钞" # 从 postuserinfo div 的 标签提取用户名(跳过电话号码) if not author: