[2016.10.14]
Thank you for your love for this software! Recently, it was discovered that the storage method of the iOS WeChat database has changed. The friend data originally stored in the Friend table has now been changed to the friend_meta table, and the fields are completely different. Therefore, the current version of this software cannot view the latest WeChat chat records. , the blogger now has a very urgent task on hand. After it is completed, he will research and develop a new version. This article will be updated and notified at that time. Thank you again for your support!
Is WeChat on iPhone taking up more and more space? Don't want to delete pictures? Don't want to delete the video? Then transfer it to the computer hard drive, use this software to view and search in Windows, and free up space on your mobile phone! This article introduces the usage instructions of the software in detail, introduces the data storage format of WeChat chat records, and provides the download address of the software and source code. Finally, it provides a method to clean up the picture and video data in iPhone chat records.
As the days of using WeChat get longer, WeChat takes up more and more space in the mobile phone, iPhone Storage space is also becoming increasingly scarce, with pictures and videos taking up the largest space. People like me who pursue integrity in everything insist on not deleting any photos or videos. I like to take photos and videos with my mobile phone. , every once in a while, move the photos and videos to the computer for storage and free up the phone. But when I have to free up space every two days, I find that this is not a long-term solution. I looked at WeChat and it has taken up more than 2 gigabytes of space. It is not an option to continue like this. Now Tencent officially does not have chat records for the iOS version of WeChat. Dump hard disk tool (Android seems to have one); even if there is, it requires that it can be viewed on Windows as on a mobile phone; WeChat’s built-in chat history backup and recovery function is designed for dumping to other devices, and chat records can only be stored on the server 7 days, and data as big as 2G needs to be uploaded to Ma Yue in the next year?
Therefore, just write a chat history viewer yourself and move the data to the computer’s large hard drive, so that you can safely delete pictures and videos on your mobile phone. The following are the instructions for using the WeChat chat record viewer developed by me, as well as the chat record data storage format that I analyzed and guessed. However, it is incomplete and can only display the most important data content. Interested friends can analyze and improve it together.
First of all, this software currently only supports WeChat chat history on iPhone. The following is a detailed description of how to use the software.
2.1 Data dump
Use third-party tools such as iTools to export the Documents directory in the WeChat application Save it to the computer hard drive. This directory contains the chat records of all WeChat accounts logged in on this iPhone. You can also export the chat records of only a certain account. The data of each WeChat account is stored in a folder named after the MD5 value of the WeChat ID. For example, the folders with 32-digit names in the Documents directory in Figure 2-1 are different WeChat accounts.
Figure 2-1 Documents directory example
2.2 Select database
The chat record database file is stored in the DB file in the WeChat account folder, and the file name is MM.sqlite. At the end of this article, we will provide an example of a chat record. When the program is running, you will be prompted to select a database file. Just select the following file: 06af9525a11ebb4f49ec72be6d165d10\DB\MM.sqlite.
2.3 Main interface
Start the software and select the database. After loading is complete, the main interface of the program is shown in Figure 2-2. On the left is the friend list of the WeChat account, sorted by the first letter of Pinyin, and on the right is the specific chat record. content. The friend list is divided into 3 tabs, namely "Friends", "Group", and "Others". As the name suggests, individual friends are on the "Friends" tab, group chats are on the "Group" tab, and the remaining subscription accounts and services No. and so on in the "Others" tab. You can search for friends above the friend list, and search for text above the chat content. Click on a friend in the friend list, and the chat content window on the right will load the specific content of the chat with the friend.
Since this program uses the trial version of the EO.WebBrowser control (the blogger is poor~), every time the program is started, the purchase license will appear on the lower side of the chat content window. Tip, just close it and it will not affect subsequent reading.
Figure 2-2 WeChat chat record viewer main interface
2.4 Data type
2.4.1 The text
is displayed in bubble style as shown on the mobile phone, as shown in Figure 2-3.
Figure 2-3 Data type example: text
2.4.2 Expression
can display the small emoji expressions that come with WeChat, as shown in Figure 2-4. See Figure 2-5 for all emoji expressions that can be displayed.
Figure 2-4 Data type example: emoji expression
Figure 2-5 All emoji that can be displayed
In addition to emoji, WeChat’s official animated emoticons can also be displayed, as shown in Figure 2-6.
Figure 2-6 Data type example: animated expression
Except these two In addition to emoticons, WeChat users often see many unofficial emoticons. If you want to display them in this software, you need to perform additional data export work, which is not complicated: still use iTools to open this directory of WeChat App: /Library/WechatPrivate/ emoticon1, copy this folder to the installation directory of this software, and overwrite the original emoticon1 folder.
2.4.3 Picture
The picture in the chat history is shown in Figure 2-7. Clicking on the picture will call the default *.jpg files are associated with a program to view large Detailed steps of WeChat chat history viewer for iOSs. The default program is Windows Photo Viewer.
Figure 2-7 Data type example: picture
2.4.4 Video & Short Video
The video and short video in the chat history are shown in Figure 2-8. Clicking on the video will call the default *.mp4 files associated with the program to watch videos.
Figure 2-8 Data type example: video & short video
2.4.5 Voice
The voice in the chat record is shown in Figure 2-9. Clicking it will play the voice content.
Figure 2-9 Example of data type: Voice
2.4.6 Sharing link
The sharing link in the chat history is shown in Figure 2-10. Clicking the link will call the browser to view the original web page.
Figure 2-10 Data type example: sharing link
2.4.7 Location information
The location in the chat record is shown in Figure 2-11. Clicking the link will call the browser to view specific map information, as shown in Figure 2-12.
Figure 2-11 Data type example: location information
Figure 2-12 Browser to view specific location information
2.4.8 Business Card
The business card message in the chat history is shown in Figure 2-13.
Figure 2-13 Data type example: business card
2.4.9 Voice and video calls
Voice and video in chat records The phone can only give information such as the duration of the call at that time (it is impossible for WeChat to record your call content D), as shown in Figure 2-14.
Figure 2-14 Example of data type: voice, video call
2.5 Search for friends
When there is a lot of friend data, enter the friend’s keyword in the search bar above the friend list on the left. It can be in Chinese or Pinyin, but the current version cannot be in Pinyin. For example, if you search for "Zhang San", you can enter "Zhang", "三", "zhangsan" or "zhangs", etc., but you cannot enter "zs". When entering content, the search results window will appear immediately, and friends that match the keyword will be listed, as shown in Figure 2-15. The friend who clicks on the search result will automatically load the content of the chat with him.
Figure 2-15 Example of searching for friends
2.6 Searching for chat content
The search for chat content is divided into "Search current friends" and "Search all friends", which can be selected from the drop-down box above the chat content window. Enter keywords in the search bar and press Enter to search. After the search is completed, the search results list will be displayed. After clicking on a record, the chat content window will display and highlight the keywords, as shown in Figure 2-16. Tip here: Searching all friends will take a long time.
Figure 2-16 Example of search chat content
2.7 Page jump
Chat content In the upper right corner of the window are navigation buttons for turning pages. If there are too many pages, you can directly click the page number, and the input window for jumping to the page will pop up. After entering the page number you want to view, you will jump to the page, as shown in Figure 2-17.
Figure 2-17 Page jump example
The root directory of the chat history is a folder named after the MD5 hash value of the user's WeChat ID username (not necessarily WeChat ID, see below). The following assumes that root is the root directory. The main content of the chat record is a SQLite-type database file MM.sqlite, and the path is root\DB\MM.sqlite. The following are the results of my analysis of the content format of this database.
3.1 Data table
Here are two data tables used by this software, namely the Friend table Table with Chat_XXX, XXX represents the MD5 value of the friend’s WeChat ID.
3.1.1 Friend table
This table stores all contacts, in addition to friends, it also includes non-friends, subscription accounts, Service number, etc.
(1) Field: type
This field can classify the types of friends, since this software is only divided into friends, groups, Others and other 3 categories, so you can refer to the following table as it is not used in the code of this software.
Table 1-1 Friend data table type field description (guess)
It can be seen that the 0th digit indicates whether the contact has added a friend; the 6th digit indicates whether the friend has been starred; the 8th digit indicates whether the friend has been blocked from the circle of friends; the 11th digit indicates whether the friend has been Pin it to the top of your phone's friends list. Wait, wait, I am ignorant and have only realized so much. Anyone who is interested can analyze the rest.
(2) Field: UsrName
In the UsrName field, those starting with "gh_" are subscription numbers and service numbers, and those starting with " @chatroom” are all groups.
3.1.2 Chat_XXX table
XXX represents the MD5 value of the friend’s WeChat ID. Each friend’s record is stored in a separate table .
(1) Field: Message
represents the specific content of the message record.
(2) Field: Type
represents the type of the message, which is specified in Section 3.2.
(3) Field: Des
0 means the message sent by myself, 1 means the message sent by the other party.
(4) Field: CreateTime
Date conversion: The CreateTime field stores a Unix timestamp, which can be used in the sql statement in the following way Conversion:
select datetime(createtime, 'unixepoch', 'localtime') from chat_XXX
3.2 Information type
3.2.1 Text
The database file of the chat record is: root\DB\MM.sqlite.
The Friend table stores the information of all friends. The field UsrName is the ID that uniquely identifies the friend, but it is not necessarily the WeChat ID. If the user applies for WeChat with a QQ number, the UsrName is qq12345678 Format, if you use WeChat ID to apply, then UsrName is WeChat ID. If you use mobile phone number to apply, then UsrName is in the form of wxid_XXXXX. In any case, perform MD5 operation on this UsrName, and the hash value obtained by adding "Chat_" in front of it is the table name that stores all the chat records of this friend, such as: Chat_a500325c723649ddb75eda10635edf82. The same goes for groups.
The ShortPY field of the Friend table stores the remark information of friends, but the encoding is different.
In the chat record table, the Message field contains all the information of the chat record with the friend. If it is text, it will be stored directly. For other formats, please see the following chapters. The CreateTime field is the time when the information was generated; if the Des field is 0, it is the information sent by the user to the friend; if it is 1, it is the information sent by the friend; if the Type field is 1, the information is text information.
3.2.2 Picture
In the friend’s chat record table, assuming it is the Chat_ a500325c723649ddb75eda10635edf82 table, if the field Type is 3, then the information is a picture. The MesLocalID field is a number, assuming it is "407". The picture is stored in "407.pic" under root\Img\a500325c723649ddb75eda10635edf82\, where "407.pic_thum" is the thumbnail of the picture.
3.2.3 Video
In the friend’s chat record table, assuming it is the Chat_ a500325c723649ddb75eda10635edf82 table, if the field Type is 43, then the information is video. The MesLocalID field is a number, assuming it is "8011", and the video is stored in "8011.mp4" under root\Video\a500325c723649ddb75eda10635edf82, where "8011.video_thum" is the thumbnail of the video.
3.2.4 Small video
In the friend’s chat record table, assume it is the Chat_ a500325c723649ddb75eda10635edf82 table. If If the field Type is 62, the information is a short video. The MesLocalID field is a number, assuming it is "8011". The video is stored in "8011.mp4" under root\Video\a500325c723649ddb75eda10635edf82, where "8011.video_thum" is the thumbnail of the small video.
3.2.5 Voice
In the friend’s chat record table, assuming it is the Chat_ a500325c723649ddb75eda10635edf82 table, if the field If Type is 34, the information is a voice clip. The MesLocalID field is a number, assuming it is "8938", and the video is stored in "8938.aud" under root\Audio\a500325c723649ddb75eda10635edf82.
AUD files are actually AMR files that lack header information. You need to add "#!AMR" to the file header to become an AMR file, and then you can use some playback methods The software is opened (in fact, there are relatively few softwares that can play AMR. Currently, only QQ Video can be played).
Console command to convert AUD to AMR: copy head.txt/b + 476.aud/b 476.amr, where the content in head.txt is "#!AMR ".
This program calls the tool provided by FFmpeg to convert it into a WAV file and then play it. This is a very powerful software that can play and convert many audio and video formats.
3.2.6 Sharing link
In the friend’s chat record table, assuming it is the Chat_ a500325c723649ddb75eda10635edf82 table, if If the field Type is 49, the information is a shared link, and the link address is between
3.2.7 Location
In the friend’s chat record table, assuming it is the Chat_ a500325c723649ddb75eda10635edf82 table, if the field Type is 48, then the information is non-real-time location information. There are specific location coordinates in the Message field. In the XML structure of the information: msg –> location –> The location coordinates are stored in the x and y fields.
3.2.8 Animated emoticons
In the friend’s chat record table, assuming it is the Chat_ a500325c723649ddb75eda10635edf82 table, if If the field Type is 47, the information is an animated expression. In the XML structure of the information: msg –> emoji –> md5 field stores the md5 value of the emoticon. Assume that the MD5 value of the emoticon is: d0546d1d8940bf82def5cc8b19185e1a, then it is in the iPhone WeChat file directory: /Library/WechatPrivate/ emoticon1 stores a file with the MD5 value as the file name, such as: d0546d1d8940bf82def5cc8b19185e1a.pic. In fact, it is a GIF file, so you can connect to the emoticon.
3.2.9 Business card
In the friend’s chat record table, assuming it is the Chat_ a500325c723649ddb75eda10635edf82 table, if the field Type is 42, then the information is a business card. In the XML structure of the information: the WeChat ID is stored in the msg –> username field, and the WeChat name is stored in the msg –> nickname field.
3.2.10 Voice calls and video calls
In the friend’s chat history table, assume it is Chat_ a500325c723649ddb75eda10635edf82 table, if the field Type is 50, then the information is a phone record. There is duration information inside:
This software is initially relatively stable, but there are still many bugs and many areas that need improvement. Please show mercy to me. The following link is an example of program files and WeChat chat records. The version when this article was finalized was 1.0.1.6. For the latest version, please refer to the homepage of the source code library.
Software download:
WechatHistory.zip (45.1 MB)
WeChat chat record example (generated by WeChat for iOS):
History_Example.zip (14.5 MB)
Due to software It contains all official animated emoticons (released before March 18, 2015) and is about 90MB in size. Animated emoticons may not be the most important content in the chat history, so this part of the data is not included in the download link of the above file. Users in need can download these animated emoticons separately:
##WeChatHistory.Sticker_Gallery.ALL.Updated_By_20150318.zip.001 (48.0 MB)WeChatHistory.Sticker_Gallery.ALL. Updated_By_20150318.zip.002 (42.3 MB)
After downloading, unzip it and copy the "emoticon1" folder to the WechatHistory folder, overwriting the original one Can.
More official emoticons will be released one after another with the official release. For details, please download from the "Source Code Download" page below. Here are some officially updated animated emoticons:
WeChatHistory.Sticker_Gallery_Patch.SpongeBob2.zip (1.41 MB)
WeChatHistory.Sticker_Gallery_Patch.LuoXiaoHei.zip (1.02 MB)
This software is used. Net Framework 4.0, so you need to install the runtime library before you can use this software:
www.microsoft.com/zh-cn/download/details.aspx?id=17718Or download directly:
download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64 .exe (48.1 MB)
If anyone is worried that the software has a backdoor and attempts to collect everyone’s private information, you can download the source code directly, check and compile it yourself and use it:
Source code download:github.com/cxun/WeChatHistory
Development tools: Microsoft Visual Studio 2012
Programming language: C
# .Net version: .Net Framework 4.0
After all the chat history has been copied from the iPhone to the computer hard drive and can be viewed normally using this software, the data can be deleted from the iPhone to free up space. There are two types of chat records that take up the most space: videos and photos. There are two ways to delete them:
##5.1 Use WeChat’s built-in cleaning function
## In WeChat's "Settings" --> "General" --> "Clean WeChat Storage Space", you can selectively delete
Advantages: Convenient, intuitive, efficient, can be selectively deleted (select friends, thumbnails)
Disadvantages: After deletion, when you click on the deleted picture or video in the iPhone chat window, it will prompt "Unable to load the picture" or "The video has expired or been cleared" and cannot be restored
5.2 Manual Cleanup
#Use iTools and other tools in Windows, open the WeChat directory, and find the WeChat storage pictures (Img) and videos ( Video) directory, such as:
/Documents/06af9525a11ebb4f49ec72be6d165d10/Video
6. Conclusion
Value | Value (binary) | Description |
1 | ##0000 0000 0001 | Friends& Others |
2 | 0000 0000 0010 | Chat group&Deleted service account&Others |
3 | 0000 0000 0011 | Friends & Others |
0000 0000 0 | 100 | This friend is in the group chat, but no friend has been added|
0000 0000 0 | 101##Friends&Others | |
##0000 0000 011 | 0Non-Friends | ##7 |
111 | Friends&Others | ##67 |
00 0011 | Voice reminder | ##257000 |
1 | Friends who have been blocked in Moments | 710000 0 |
111 | Collect and star friends##2119 | 1 |
00 0111 | Pinned friends | |
259 | ##00010000 0011 | Friends who have been blocked in Moments |
263 | 00010000 0111 | Friends who have been blocked in Moments |
The above is the detailed content of Detailed steps of WeChat chat history viewer for iOS. For more information, please follow other related articles on the PHP Chinese website!