fix(scraper): 过滤type=-2日期分隔线 + 清理DB已有4062条分隔线
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -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]}")
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user