Last active
August 29, 2015 13:59
-
-
Save jmandel/10556077 to your computer and use it in GitHub Desktop.
export skype chat hsitory for FHIR Implementers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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