Skip to content

Instantly share code, notes, and snippets.

@ScDor
Created April 8, 2020 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ScDor/47f187239cd1b55cfb4011aa2d5055bc to your computer and use it in GitHub Desktop.
Save ScDor/47f187239cd1b55cfb4011aa2d5055bc to your computer and use it in GitHub Desktop.
whatsapp group picture extractor
import sqlite3
DB_FILE = r"PATH\TO\DB\FILE"
GROUP_ID = GROUP_ID \\ see messages.key_remote_jid, appears after the "@" sign
con = sqlite3.connect(DB_FILE)
with con:
cur = con.cursor()
image_paths = cur.execute(f"select file_path from message_media where "
f"message_media.file_hash in (SELECT media_hash from messages "
f"WHERE key_remote_jid LIKE '%{GROUP_ID}%' "
f"and media_hash is not null)").fetchall()
print(image_paths)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment