Back up and read WeChat contacts
Suddenly it occurred to me — what if one day my WeChat account gets banned, causing me to lose all my contacts and bringing a lot of inconvenience? So today, I backed up my WeChat contact list. If I ever lose access to my account, I can still find my contacts through this backup file.
Backup Steps
Use iTunes (now integrated into Finder under Devices) to create an unencrypted backup.
The time needed depends on your device’s data size. My iPhone 14 Pro (256GB, used 149GB) took 35 minutes to back up.Use iPhone Backup Extractor in Expert Mode to extract the file
Applications/com.tencent.xin/Documents/[MD5 of Your WeChat ID]/DB/WCDB_Contact.sqliteOpen the extracted
WCDB_Contact.sqlite
file using DB Browser for SQLite.
Select the Friend table, then from the menu, choose File → Export → Table(s) as CSV File…
Why Export as CSV?
Just take a look at how the data appears when opened directly with DB Browser for SQLite.
Many fields are of BLOB binary type, making it very unintuitive and inconvenient for reading and searching.
Especially the dbContactRemark
field — it’s in a strange format, containing a mix of Unicode characters, nicknames, modified WeChat IDs, notes, pinyin, and more. When parsing, I needed to skip the [\u0000-\u001f]
character set.
Parsing and Querying the Data in the .CSV
Source code is here. Safe and open-source. Fully local parsing, so you can use it with confidence.
Once the .csv file is loaded, by default it filters out entries with type === 4
(i.e., people who are in the same group chat but not your friends).
If you want to view these, you can clone and run the project locally, and modify the filter condition in /src/index/index.tsx
.
For ease of searching, the table displays four columns: avatar (dbContactHeadImage
), WeChat ID (userName
), WeChat Name (dbContactRemark
), and Remark (dbContactRemark
).
Click the ➕ symbol at the start of each row to expand and view the raw data.
The search box will match keywords from the userName
and dbContactRemark
fields.
Enum Values of the type
Field in the Friend Table
These are results I obtained based on my own contact data, for reference only.
type | meaning |
---|---|
0 | WeChat Payment Assistant, Mini Program Merchant Helper |
1 | Official Accounts, Moments, Friends |
2 | WeChat Groups (not created by me), People Nearby, Shake |
3 | Friends |
4 | In the same group but not friends |
5 | Friends added via shared contact cards |
7 | Friends added from WeChat groups |
8 | Blacklist |
33 | QQ Mail Reminder |
259,263 | Hide Moments from them |
515 | Official Account |
2049 | File Transfer Assistant |
2050 | WeChat Groups I created |
65537,65539,65543, 65795,66051,73729, 98307,98311 | Don’t see their Moments |
8388611,8388615,8388867, 8421379,8421635 | Chat only |
268435458 | WeChat Group |
2147483649,2147483651 | Official Account |