This Python script is designed to transform a WhatsApp chat log, including associated media files, into an interactive HTML document. It provides an easy-to-navigate format for viewing chat histories, complete with embedded media like images, audio, and videos. It has been updated to support both iOS and Android exports.
Chat Conversion: Converts a WhatsApp chat log file (_chat.txt
for iOS and folder_name + '.txt'
for Android) into a formatted HTML document.
Media Embedding: Embeds images, audio, and video files directly into the chat flow, allowing for inline viewing and playback.
Versioned Output: The script generates HTML files with incremental version numbers to keep track of multiple conversions.
- Prepare Chat and Media Files:
- Export your WhatsApp chat along with media files. This will typically generate a folder containing a _chat.txt file (for iOS) and various media files.
- Run the Script:
- Place the script in the same directory as the folder which contains the chat and media files.
- Note: You can have multiple chat folders, the script will prompt you for which folder you want to export.
- Run the script. When prompted, enter the path to the folder containing your exported WhatsApp chat and media files.
- View and Interact with HTML:
- The script will generate an HTML file named after the folder containing the chat log, appended with a version number (e.g., ChatFolder_v0.html).
- Open this HTML file in a web browser to view the formatted chat. #- Use checkboxes next to each message to select messages. (planned) #- Click the “Create Summary” button to open a new HTML document with only the selected messages. (planned)
#4. Summary HTML: (planned) #- The summary HTML is displayed in a new browser window or tab. #- This document can be saved manually from the browser for record-keeping or sharing.
- Python environment (Python 3.x recommended).
- The script must be run in an environment where it can accept input (like a command line or terminal).
- A web browser for viewing the generated HTML files.
- The script handles paths with spaces and most special characters. Enclose the path in quotes if it contains spaces.
- Paths should follow the format of the operating system (e.g., backslashes \ on Windows, forward slashes / on Unix-like systems).
- The generated HTML file is best viewed in modern web browsers that support HTML5.
- Add the ability to select messages and media and create a "summary" html
- This script is intended for personal use and should be used responsibly and ethically.
- Ensure that you have the right to convert and view the chat history, respecting the privacy and consent of all parties involved in the chat.