Skip to content

Instantly share code, notes, and snippets.

@dwf
Created February 1, 2010 21:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dwf/292030 to your computer and use it in GitHub Desktop.
Save dwf/292030 to your computer and use it in GitHub Desktop.
A script that dumps convoluted XML log files from MSN Messenger to readable plaintext.
"""
Simple script I whipped up to dump MSN Messenger logs in XML to a readable
plaintext format. It's not very robust, nor am I sure which versions of MSN
Messenger it's compatible or incompatible with; I just had a specific
conversation I wanted to read, and this was the vehicle to that end.
By David Warde-Farley -- user AT cs dot toronto dot edu (user = dwf)
Redistributable under the terms of the 3-clause BSD license
(see http://www.opensource.org/licenses/bsd-license.php for details)
"""
import sys
from xml.dom.minidom import parse
if len(sys.argv) != 2:
print >>sys.stderr, "usage: " + sys.argv[0] + " <inputfile>"
sys.exit(1)
doml = parse(sys.argv[1])
for message in doml.getElementsByTagName("Message"):
fromNode = message.getElementsByTagName("From")[0]
userNode = fromNode.getElementsByTagName("User")[0]
name = userNode.getAttribute("FriendlyName") + \
" says:"
print name.encode('utf-8')
msg = message.getElementsByTagName("Text")[0].firstChild.nodeValue
print msg.encode('utf-8')
print ""
@xenek
Copy link

xenek commented Aug 1, 2022

Google & Ecosia had no simple third party tools listed or still active on the first 10 or so pages of results when I tried to do this earlier, to 'read some old chats, as a short review of the past'.

So, I was happy to see this code. It looked easy to use. thanks DWF.
I almost used it to get to those old MSN messenger chats...
I was going to delve into this code, and rework it... :) but being practical, driven, busy & motivated by more than coding... I looked for something easier, that anyone could do or use, someone on a PC who's 'barely technical', more of a user of computing systems, than a builder of computing systems.

Internet Explorer was mentioned a few times on the ecosia search results, as one way to open the XLM, but it's missing from the new Windows installations in 2022. I figured I would try that before coding.

And I found out how to do it. So if you're not interested this type of coding, here's a way:
(this means you could eg. use that time doing some other sort of coding instead, if you enjoy coding!)

on windows 11 pro (latest as of 1/8/2022)
search the start bar for optional features
install 'internet explorer mode' by clicking the button to the right of the entry.
it's the first entry in the list of optional features
(it was installed by default for me, on this version)

close the optional features installation tool

After that,

open Edge.
open the Edge settings using the three-dot button just below the x in the top right corner.
Search the settings for 'internet explorer'.
You'll find you can turn on the 'Internet Explorer mode (IE mode) button'
(on my Edge, it was 'off' by default.

Now, on Windows 11,
find an old MSN Messenger XML file, copied from an old user profile folder backup from old copies of windows,
right click on an old MSN Messenger XML file,
open it in Edge,
it will open and display as a blank page,
nothing will appear to happen,

Here's the trick.
Click the toolbar button to 'view in IE mode'

your chat will then appear,
very neat, formatted,
with dates and times and also,
showing the status at the time of messages listed.

You can print to PDF,
and you have a copy of the chats,
with the time & dates,
without any difficulty or coding or other software needed.

And lastly,
if you're like me,
you can be embarrassed by all the things you said,
that you never made real.
Time to get onto your things, those you see are good to improve on! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment