Exporting a full WhatsApp chat to .txt


Question

So, I've decided to try and do some analysis on my WhatsApp chat history. For that purpose, the built-in export function would work quite well, but it is for some reason restricted to the latest 40.000 messages. Some of my chats go back way further than that, and I'd like to include those conversations in my dataset.


And that's where it gets complicated. Things I've tried so far:



  1. A variety of recovery tools (drfone, BackupToolForWhatsApp,...) that invariably failed to connect and/or demanded a lot of money and/or contained malware



  2. Finding the msgstore.db.crypt12 as a file on the phone and opening it as text with various apps (some people claimed that worked, it didn't though, everything just crashed or complained about the format)



  3. Copying the msgstore.db.crypt12 onto my computer and there decrypting it with the key file, which led to the next problem, obtaining said key file.



  4. A bunch of outdated and thus no longer functional WhatsApp key extractor tools which tried to either grab the backups off Google Drive, or temporarily install a legacy Version of WhatsApp with a vulnerability that allowed the key to be extracted. This failed because the tools haven't been updated in like three years and I'm not Java-savy enough to go digging in their source code myself. I actually downloaded a legacy APK to try and manually install that old WhatsApp version, but that only led to an error about the datetime of my phone (which was set to automatic and thus was correct) and no key.



  5. Rooting my phone in order to get access to the directory where the key is hopefully located. This failed, perhaps because I did the mistake of updating my firmware to the July 2019 patch level, and so no root exploits seemed to work



  6. Digging around in protected directories with tools that do not quite require root access. However, I wasn't able to locate anything that even looked like the place WhatsApp might store its key.



  7. Reading through lots of forum posts on the same issue without any discernible results.




I'm using a Samsung Galaxy S8, model number SM-G950F, German localization, with Android 9.


My question is simple: What else can I do? It can't be that it's literally impossible to dig at the messages which WhatsApp is happily storing and backing up. I'd even be willing to buy some software as long as it's reasonably priced and guaranteed to work.


Also, what directory would I be looking for to get that key, assuming I'd somehow get root access?


Update 28.07.2020:
It seems that in some locales (specifically the EU?), the native export function was disabled in its entirety. The method detailed in my answer below still works excellently, however.


Answer

So, here's the solution I ended up using. Even though it's not ideal, it worked out, so I'll leave this here in case anyone else stumbles upon this.



The weak link in the chain is WhatsApp Web. Specifically, it's possible to write a tool that just scrapes the data WhatsApp Web receives, and someone on the Chrome Web Store did exactly that: The Backup WhatsApp Chats extension. It's like €3, so well within what I'd consider reasonable. However, I'd expect that anyone with more knowledge of coding than I have could write such a script themselves, because the messages in WhatsApp Web are apparently just displayed as plain HTML.



It's reasonably fast and extracts all the non-media data you might want in csv format that can be parsed pretty well by pandas.



I'll accept my own answer because this is a solution within the parameters I set out, but if someone knows a better way, feel free to post it and I'll shift the accept.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes