fix(scraper): 过滤type=-2日期分隔线 + 清理DB已有4062条分隔线

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-15 15:07:43 +08:00
parent 9eb747f2b3
commit bcacf80a7b
2 changed files with 10 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
import sqlite3
con = sqlite3.connect('smoke.db')
c = con.cursor()
deleted = c.execute('DELETE FROM message WHERE type_raw = -2').rowcount
con.commit()
print(f'Deleted {deleted} divider messages')
print(f"Remaining wechat: {c.execute(chr(34)+'SELECT COUNT(*) FROM message WHERE channel=' + chr(39) + 'wechat' + chr(39) + chr(34)).fetchone()[0]}")
+3
View File
@@ -453,6 +453,9 @@ async def scrape_messages(cookie_str: str, max_conversations: int = 100):
for row in rows:
if not isinstance(row, dict):
continue
# 跳过 type=-2 日期分隔线(非真实消息,仅显示日期)
if str(row.get("type")) == "-2":
continue
# Normalize to Message shape
ts_raw = row.get("createTime") or row.get("timestamp")
try: