Skip to content

Instantly share code, notes, and snippets.

@jmandel

jmandel/export_history.py

Last active Aug 29, 2015
Embed
What would you like to do?
export skype chat hsitory for FHIR Implementers
import sqlite3
import json
import sys
# e.g. python export_history.py /home/jmandel/.Skype/jcmandel/main.db > export.json
c = sqlite3.connect(sys.argv[1])
c.row_factory = sqlite3.Row
cur = c.cursor()
# Note: the "chatname" for the FHIR Implementers chat is:
# `#ewoutkramer/$f6a8a0ea0abcc75d`
cur.execute("""
SELECT
author,
body_xml,
chatname,
date(timestamp, 'unixepoch') as timestamp,
date(edited_timestamp, 'unixepoch') as edited_timestamp
FROM messages
WHERE
chatname="#ewoutkramer/$f6a8a0ea0abcc75d" and
body_xml not null
order by timestamp;
""")
posts = [dict(r) for r in cur.fetchall()]
print json.dumps(posts, indent=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.