Commit ca6e627

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-10-03 03:16:17
fix(danmu): fix timestamp is None
1 parent d7a4dec
Changed files (1)
src
danmu
src/danmu/sync.py
@@ -121,7 +121,7 @@ async def save_livechats_to_turso(live_info: dict, data: list[dict], qtype: str)
             normed_data.append({"time": f"{date} {time}", "content": x["content"], "segmented": " ".join(cutter.cutword(x["content"]))})
             added.add(f"{date}{time}{x['content']}")
     else:
-        for x in sorted(data, key=lambda x: x.get("timestamp", 0)):
+        for x in sorted(data, key=lambda x: x.get("timestamp") or 0):
             # time, user, fullname, content, uid, superchat, currency, segmented
             item = {}
             if not all([x.get("timestamp"), x.get("authorName")]):