My platform:
Mac OS X Lion 10.7.2
Some things are used:
0. IExplorer. app
Export the sqlite database file that saves the chat data to your computer,
The location of the database is (the QQ number is blurred ):
Export the db file to your computer and change the suffix to. sqlite.
I didn't know this. db file was the sqlite database file with the suffix modified during the previous test.
However, when I think that the database in ios is almost sqlite, I will try to change the suffix ~
Speaking of this, we should despise the carelessness of the ios qq development team. If I do this,
Will the sqlite database file storing chat records use at least one suffix other than db? Db is too eye-catching.
Or disguise the database file as a sound file. After each modification, the lastModified attribute of the database file is not modified,
I think it will be much more difficult to find this database file ~
1. SqliteManager plug-in of FireFox
SqilteManager is mainly used to parse the sqlite database files exported to the computer,
I don't know whether it is the limitation of sqlite or because of other reasons,
I found that the data in sqlite seems to be in plain text. Can't I encrypt it?
Once again, I despise ios qq developers ~
As shown above, everything in plain text is simplified. Let's take a look at the chat records in the data table in the previous figure:
Click the Actions drop-down list and select Save Result (CSV) to File to export the chat records you are interested in as csv files.
The csv file can be opened in excel, but it is a bit problematic. After opening it, it is found that all the content is garbled,
I am not very familiar with excel and do not know where to adjust the character encoding.
Okay, since we can't count on excel, let's use java to get it.
2. Opencsv
I found some information on the Internet and found an open-source framework for parsing csv files in java-opencsv
The sourceforge.net can be downloaded to the binary jar package, which will be used in programming.
3. Eclipse
Return to the old line and directly add the Code:
[Java] package org.bruce.vertices.extra.csv;
Import java. io. File;
Import java. io. FileReader;
Import java. text. SimpleDateFormat;
Import java. util. Date;
Import java. util. List;
Import au.com. bytecode. opencsv. CSVReader;
/**
* @ Author Bruce Yang
* When you use SQLiteManager to save the chat record table as a csv file, use the following SQL query:
* Select uin, time, content from tb_message where uin = 123456 (the QQ number you are interested in )~
* The generated txt lines are a unit. The first line is the QQ number, the second line is the message sending time, and the third line is the message content,
* Separate units with empty rows ~
*/
Public class TestOpenCSV {
/**
* @ Param csvPath
* @ Return
* @ Throws Exception
*/
Public static List <String []> getLines (String csvPath) throws Exception {
File f = new File (csvPath );
If (! F. exists ()){
System. out. println ("the file does not exist ~ ");
Return null;
}
CSVReader csvReader = new CSVReader (new FileReader (f ));
List <String []> lines = csvReader. readAll ();
CsvReader. close ();
Return lines;
}
/**
* @ Param args
* @ Throws Exception
*/
Public static void main (String [] args) throws Exception {
List <String []> result = getLines ("/Users/user/Desktop/output.csv ");
If (result = null ){
System. err. println ("The path of the target csv file is invalid. Please verify that ~ ");
}
SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd HH: mm: ss ");
For (int I = 0; I <result. size (); ++ I ){
String [] item = result. get (I );
For (int j = 0; j <item. length; ++ j ){
If (j = 0 ){
System. out. println ("QQ:" + item [j]);
} Else if (j = 1 ){
// Convert the time format to a more elegant one (the last three digits have to be removed and added back )~
Long time = Long. parseLong (item [j] + "000 ");
Date date = new Date (time );
System. out. println ("time:" + sdf. format (date ));
} Else if (j = 2 ){
System. out. println ("message:" "+ item [j]. trim () + '"');
}
}
System. out. println ();
}
}
}
Package org.bruce.vertices.extra.csv;
Import java. io. File;
Import java. io. FileReader;
Import java. text. SimpleDateFormat;
Import java. util. Date;
Import java. util. List;
Import au.com. bytecode. opencsv. CSVReader;
/**
* @ Author Bruce Yang
* When you use SQLiteManager to save the chat record table as a csv file, use the following SQL query:
* Select uin, time, content from tb_message where uin = 123456 (the QQ number you are interested in )~
* The generated txt lines are a unit. The first line is the QQ number, the second line is the message sending time, and the third line is the message content,
* Separate units with empty rows ~
*/
Public class TestOpenCSV {
/**
* @ Param csvPath
* @ Return
* @ Throws Exception
*/
Public static List <String []> getLines (String csvPath) throws Exception {
File f = new File (csvPath );
If (! F. exists ()){
System. out. println ("the file does not exist ~ ");
Return null;
}
CSVReader csvReader = new CSVReader (new FileReader (f ));
List <String []> lines = csvReader. readAll ();
CsvReader. close ();
Return lines;
}
/**
* @ Param args
* @ Throws Exception
*/
Public static void main (String [] args) throws Exception {
List <String []> result = getLines ("/Users/user/Desktop/output.csv ");
If (result = null ){
System. err. println ("The path of the target csv file is invalid. Please verify that ~ ");
}
SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd HH: mm: ss ");
For (int I = 0; I <result. size (); ++ I ){
String [] item = result. get (I );
For (int j = 0; j <item. length; ++ j ){
If (j = 0 ){
System. out. println ("QQ:" + item [j]);
} Else if (j = 1 ){
// Convert the time format to a more elegant one (the last three digits have to be removed and added back )~
Long time = Long. parseLong (item [j] + "000 ");
Date date = new Date (time );
System. out. println ("time:" + sdf. format (date ));
} Else if (j = 2 ){
System. out. println ("message:" "+ item [j]. trim () + '"');
}
}
System. out. println ();
}
}
}
Generated plain text file:
[Java] QQ No.: 123456
Time: 20:00:36
Message: "Ah"
QQ: 123456
Time: 20:00:41
Message: "write code first"
QQ: 123456
Time: 20:00:45
Message: "Have you finished calling you ?"
QQ: 123456
Time: 20:00:47
Message: "how"
QQ: 123456
Time: 20:00:50
Message: "Oh, OK"
QQ: 123456
Time: 12:09:59
Message: "speed"
QQ: 123456
Time: 12:10:02
Message: "dog"
QQ: 123456
Time: 20:00:36
Message: "Ah"
QQ: 123456
Time: 20:00:41
Message: "write code first"
QQ: 123456
Time: 20:00:45
Message: "Have you finished calling you ?"
QQ: 123456
Time: 20:00:47
Message: "how"
QQ: 123456
Time: 20:00:50
Message: "Oh, OK"
QQ: 123456
Time: 12:09:59
Message: "speed"
QQ: 123456
Time: 12:10:02
Message: "dog"
Close ~
From yang3wei's column