Skip to content

Commit

Permalink
Workaround for non-UTF8 message
Browse files Browse the repository at this point in the history
  • Loading branch information
KnugiHK committed May 19, 2023
1 parent 0a0ae8c commit 9ac8839
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Whatsapp_Chat_Exporter/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,15 @@ def messages(db, data):
else:
table_message = False
i = 0
content = c.fetchone()
while True:
try:
content = c.fetchone()
except sqlite3.OperationalError:
continue
else:
if content is not None and isinstance(content["data"], bytes):
continue
break
while content is not None:
if content["key_remote_jid"] not in data:
data[content["key_remote_jid"]] = ChatStore()
Expand Down Expand Up @@ -377,7 +385,15 @@ def messages(db, data):
i += 1
if i % 1000 == 0:
print(f"Gathering messages...({i}/{total_row_number})", end="\r")
content = c.fetchone()
while True:
try:
content = c.fetchone()
except sqlite3.OperationalError:
continue
else:
if content is not None and isinstance(content["data"], bytes):
continue
break
print(f"Gathering messages...({total_row_number}/{total_row_number})", end="\r")


Expand Down

0 comments on commit 9ac8839

Please sign in to comment.