Skip to content

Instantly share code, notes, and snippets.

@mlooney
Created January 21, 2012 16:52
Show Gist options
  • Save mlooney/1653268 to your computer and use it in GitHub Desktop.
Save mlooney/1653268 to your computer and use it in GitHub Desktop.
Extract chat history from skype logs
corpus = Hash.new {|h,k| h[k]=[]}
SQLite3::Database.new( "/Users/username/Library/Application Support/Skype/skypename/main.db", :readonly=>true ) do |db|
db.execute("select timestamp,author, body_xml from messages") do |row|
ts, author, body = row
corpus[author]<<(body) if body
end
end
corpus.each do |k,v|
File.open("corpus_#{k}.txt", 'w') do |f|
v.each{|k|f.puts(k)}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment