Skip to main content

Convert WhatsApp exports to Markdown/HTML with media linking/embedding.

Project description

whatsapp-export-md

Convert exported WhatsApp chats (Android/iOS) into Markdown or HTML, with proper handling of media:

  • Recognizes <attached: FILENAME> and bare filenames
  • Links media with relative paths or embeds via Base64 (--embed)
  • Supports images, audio (incl. .opus), video, and PDFs
  • Robust parsing of timestamps and multi‑line messages
  • Optional JSON dump of parsed messages for further analysis

Privacy-friendly: runs completely locally on your machine.

Install

pip install whatsapp-export-md

Requires Python 3.9+

Quick start

# HTML with embedded media (up to 8 MB each)
whatsapp-export-md   --input "/Exports/Family Chat.txt"   --media-dir "/Exports/Family Chat"   --out "/Exports/family_chat.html"   --format html --embed --embed-max-mb 8

# Markdown without media embedding
whatsapp-export-md   --input "/Exports/Project Team.txt"   --out "project_team.md"   --format md --title "Project Team"

Recommended folder layout:

/Exports/
  Chat.txt
  Chat/                 # WhatsApp-created media folder for that chat
    IMG-....jpg
    VID-....mp4
    00001234-AUDIO....opus
  chat.html             # save your output here

Features

  • Android/iOS export formats, system messages
  • Per‑day grouping and clean HTML layout
  • Linkify plain http(s):// URLs
  • Smart filename resolution:
    • case‑insensitive
    • ignores brackets (1) and spacing/underscore/dash differences
  • Correct MIME mapping for .opus, .m4a, .pdf

CLI

usage: whatsapp-export-md --input INPUT --out OUT [--format {md,html}] [--media-dir DIR]
                          [--embed] [--embed-max-mb N] [--tz ZONE] [--title TITLE] [--json PATH]

Options:
  --input PATH          Exported WhatsApp .txt file
  --out PATH            Output file (.md or .html)
  --format md|html      Output format (default: md)
  --media-dir DIR       Path to the exported media folder (optional)
  --embed               Inline media as Base64 data URIs (HTML only)
  --embed-max-mb N      Max per-file embed size in MB (default: 8)
  --tz ZONE             Display timezone (default: Asia/Kolkata)
  --title TITLE         Document title
  --json PATH           Also dump parsed JSON

Tips

  • For large videos, consider not embedding (--embed off) to keep HTML size small.
  • PDFs are shown via <embed> when embedded, otherwise linked.
  • If you see a note like “Could not resolve these media tokens”, confirm that the files exist in --media-dir. The resolver handles common renames (e.g., file.pdf vs file (1).pdf).

Development

git clone https://github.com/mshammas/whatsapp-export-md
cd whatsapp-export-md
pip install -e ".[test]"

License

MIT © Mohammed Shammas

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whatsapp_export_md-0.1.7.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whatsapp_export_md-0.1.7-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file whatsapp_export_md-0.1.7.tar.gz.

File metadata

  • Download URL: whatsapp_export_md-0.1.7.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for whatsapp_export_md-0.1.7.tar.gz
Algorithm Hash digest
SHA256 48030b349c114276013278a6e0959b188c0b82261c8086d0719c3a765b6b0f60
MD5 10026a3271d668faf5e42cd544076f6d
BLAKE2b-256 59fe6d716d25989f94180bdffb6e82abd33fba6d4ba423d93b11a2b0b61a8bcb

See more details on using hashes here.

File details

Details for the file whatsapp_export_md-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for whatsapp_export_md-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 77fc624027eab64ddd09ee948118a8cf362ab18f22faa813af5aca9213017947
MD5 ae5ac554e128bfa453b9139184734209
BLAKE2b-256 bb20fdec810e23d065d824bc771d23bc46138461103a0b2841b9c4ec1fdea196

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page