Export Google Talk/Hangouts chats to logfiles, using both mbox IMAP folders (for Google Talk) and Takeouts exports (for Google Hangouts)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
gtalk_export.py
hangouts.py

README.md

gtalk_export

  • Author: Clint Olson (with JSON-parsing code from Jay2K1)
  • License: MIT
  • Meaning: Use everywhere, keep copyright, it'd be swell if you'd link back here.

Usage

Export Google Talk/Hangouts chats to logfiles

Uses a modified version of Jay2K1's Takeouts parser (for Hangouts chats) alongside a custom mbox parser (for older Google Talk chats made before mid-2013) to produce a single set of unified logfiles.

To use it, follow these steps:

  1. Export your Google Hangouts data using Google Takeout. You'll be using the "Hangouts.json" file from the archive this gives you.
  2. Enable IMAP on your GMail account.
  3. Check the box to make Chats show up in IMAP, as detailed here
  4. Download your GMail IMAP chats folder ([Gmail]/Chats) using a desktop email client (script tested with Thunderbird). This script supports Maildir mailboxes by default, but the mbox format can also be used via the -m flag. I recommend Thunderbird's ImportExportTools addon to assist in obtaining the file required. If using Thunderbird and Maildir, it's suggested to backup your emails first & enable maildir at the local level if you regularly use Thunderbird. Maildir can be enabled in the settings 3 different ways:
  • Options - Advanced - Advanced Configuration - Message Store Type for new accounts
  • Account Settings - Server Settings - Message Storage - Message Store Type
  • Account Settings - Local Folders - Message Storage - Message Store Type
  1. Check out this repository to a directory.
  2. Run this command: python gtalk_export.py -p <path/to/mbox_file_or_maildir_directory> -j <path/to/json_file> -n <your name> -e <your email> If using mbox, add -m to the end of the command

The program needs your name and email so that it knows who "you" are, and by extension who the other party is -- some of the mbox-format chats just list participants with no indication of which one is the account being parsed. Running the command will generate a large number of .txt files in the current working directory (one for each contact you conversed with).