Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 1152562 Dev Branch #45

Open
Stratos-Crimson opened this issue May 19, 2023 · 25 comments
Open

KeyError: 1152562 Dev Branch #45

Stratos-Crimson opened this issue May 19, 2023 · 25 comments

Comments

@Stratos-Crimson
Copy link

Hello,
I tried to use the dev branch to export so that I could bypass the #44 issue but now I have this.
I installed using pip install git+https://github.com/KnugiHK/Whatsapp-Chat-Exporter.git@dev.

Traceback (most recent call last):
  File "/home/user/.local/bin/wtsexporter", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.9/site-packages/Whatsapp_Chat_Exporter/__main__.py", line 241, in main
    media(db, data, args.media)
  File "/home/user/.local/lib/python3.9/site-packages/Whatsapp_Chat_Exporter/extract.py", line 439, in media
    data[content["key_remote_jid"]].messages[content["message_row_id"]].media = True
KeyError: 1152562
@Stratos-Crimson
Copy link
Author

@KnugiHK ?

@KnugiHK
Copy link
Owner

KnugiHK commented Jun 1, 2023

Can you confirm if there is a row in message table with "1152562" in _id field?

@Stratos-Crimson
Copy link
Author

Yes there is.

@Stratos-Crimson
Copy link
Author

It's NULL though.

@KnugiHK
Copy link
Owner

KnugiHK commented Jun 3, 2023

If it is NULL it cannot be 1152562.

@Stratos-Crimson
Copy link
Author

You misunderstand, there is a row with that id but the message content is NULL

@Stratos-Crimson
Copy link
Author

Perhaps message contents that are NULL should simply be ignored just like non UTF-8 weirdness?

@KnugiHK
Copy link
Owner

KnugiHK commented Jun 10, 2023

A NULL message doesn't necessarily be invalid (e.g., the row represents other metadata or media). It shouldn't be ignored.

@Stratos-Crimson
Copy link
Author

Then why did It error out on that?

@KnugiHK
Copy link
Owner

KnugiHK commented Jun 11, 2023

The corresponding message entry didn't get added into the chat store probably.

@Stratos-Crimson
Copy link
Author

So perhaps the ones that error out like this can be skipped too instead of stopping the whole process?

@Stratos-Crimson
Copy link
Author

Is there a way to detect If something didn't get added to the chat store? If so, then you could just skip ones that didn't.

@KnugiHK
Copy link
Owner

KnugiHK commented Jun 15, 2023

Could you provide me the outputs of SELECT * FROM message WHERE _id=1152562; and SELECT * FROM message_media WHERE message_row_id=1152562? I would like to further investigate the problem before I skipping it.

@Stratos-Crimson
Copy link
Author

Can I just send you the row again? This didn't work out well last time.

@KnugiHK
Copy link
Owner

KnugiHK commented Jun 16, 2023

Sure.

@Stratos-Crimson
Copy link
Author

Done

@KnugiHK
Copy link
Owner

KnugiHK commented Jun 19, 2023

I couldn't reproduce the bug after I inserted the rows you sent to me. What's the output of the following SQL?

SELECT jid.raw_string as key_remote_jid,
       message_row_id,
       file_path,
       message_url,
       mime_type,
       media_key,
       file_hash,
       thumbnail
FROM message_media
INNER JOIN message
    ON message_media.message_row_id = message._id
LEFT JOIN chat
    ON chat._id = message.chat_row_id
INNER JOIN jid
    ON jid._id = chat.jid_row_id
LEFT JOIN media_hash_thumbnail
    ON message_media.file_hash = media_hash_thumbnail.media_hash
WHERE message_row_id = 1152562 OR key_remote_jid = 1152562
ORDER BY jid.raw_string ASC

@KnugiHK
Copy link
Owner

KnugiHK commented Jun 20, 2023

Since 3ed269e, the invalid flag is removed, and all possible messages are included in the output. You can try to re-install and re-run the exporter from dev to see if the problem persists.

@Stratos-Crimson
Copy link
Author

It's persisting

@Stratos-Crimson
Copy link
Author

I got a lot of gibberish but I did get audio/mp4 with this "|" around It. The quotes weren't there, of course.

I couldn't reproduce the bug after I inserted the rows you sent to me. What's the output of the following SQL?

SELECT jid.raw_string as key_remote_jid,
       message_row_id,
       file_path,
       message_url,
       mime_type,
       media_key,
       file_hash,
       thumbnail
FROM message_media
INNER JOIN message
    ON message_media.message_row_id = message._id
LEFT JOIN chat
    ON chat._id = message.chat_row_id
INNER JOIN jid
    ON jid._id = chat.jid_row_id
LEFT JOIN media_hash_thumbnail
    ON message_media.file_hash = media_hash_thumbnail.media_hash
WHERE message_row_id = 1152562 OR key_remote_jid = 1152562
ORDER BY jid.raw_string ASC

@Stratos-Crimson
Copy link
Author

@KnugiHK ?

@KnugiHK
Copy link
Owner

KnugiHK commented Jul 7, 2023

Could you show me the output?

@Stratos-Crimson
Copy link
Author

Sure and sorry for taking a while.
�B.�Q�i)9~�23G�|H07O6FjcvxRvp+M1OKqJyqIG5ulpIGlfYDjv6SQA8T0=|/AvdxZMCJ2RXhBpJLY2IDedZ9ZaYfsqTWmSguEZFGaC6b.enc|audio/mp4|�_A6��k#�[3+�

@qosch
Copy link

qosch commented May 10, 2024

Had the same issue with latest main branch, but dev worked.

@Stratos-Crimson
Copy link
Author

I will try again then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants