3 ms·
You can get data out of Gmail programmatically by using their APIs; but there's also a feature called 'Google Takeout' [1] that allows you to request a single-f
by niftich 10y ago
You can get data out of Gmail programmatically by using their APIs; but there's also a feature called 'Google Takeout' [1] that allows you to request a single-file .mbox dump of all your email.
Neither of them give you what you want by themselves; additional processing is required to get it into the format you want. The .mbox route is probably easier for your use-case because it gives you the complete dataset, and you don't have to write a client that makes several API calls.
Luckily the .mbox format has parsers in many languages that allow you to navigate its structure (four random examples: [2][3][4][5]), Python's in their standard lib, so you can do a simple script like this one, [6], and modifying it slightly to pull the data you need out.
[1] https://support.google.com/accounts/answer/3024190?hl=en https://support.google.com/accounts/answer/3024190?hl=en
[2] https://docs.python.org/3.6/library/mailbox.html https://docs.python.org/3.6/library/mailbox.html
[3] http://search.cpan.org/~dcoppit/Mail-Mbox-MessageParser-1.5105/lib/Mail/Mbox/MessageParser.pm http://search.cpan.org/~dcoppit/Mail-Mbox-MessageParser-1.51...
[4] https://github.com/robertklep/node-mbox https://github.com/robertklep/node-mbox
[5] https://github.com/bthomson/mbox https://github.com/bthomson/mbox
[6] https://gist.github.com/davidpelayo/139db134ca2337e966bb https://gist.github.com/davidpelayo/139db134ca2337e966bb
- actfrench 10y agoThank you!