Last active
May 26, 2021 10:21
-
-
Save spudtrooper/87243baec2b1a642f850fceace730f87 to your computer and use it in GitHub Desktop.
Produces markdown output of all Google Keep notes containing a certain phrase.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Produces markdown output of all Google Keep notes containing a certain phrase. | |
Requirements: | |
pip install gkeepapi | |
Usage: | |
python keepdocs.py <gmail-username> <gmail-password> <query> | |
Example: | |
python keepdocs.py jeffpalm Jeffs-Gmail-Password pilot | |
""" | |
import gkeepapi | |
import sys | |
def main(argv): | |
if len(argv) < 4: | |
print(''' | |
Usage: python {me} <gmail-username> <gmail-password> <query> | |
Example: | |
python {me} jeffpalm Jeffs-Gmail-Password pilot | |
'''.format(me=argv[0])) | |
return | |
username, password, query = argv[1], argv[2], argv[3] | |
keep = gkeepapi.Keep() | |
success = keep.login('%s@gmail.com' % username, password) | |
if not success: | |
print('could not log in') | |
return | |
notes = keep.find(query=query) | |
for note in notes: | |
print('') | |
title = note.title | |
if not title: | |
title = note.id | |
print('# %s' % title) | |
print(note.text) | |
if __name__ == '__main__': | |
main(sys.argv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment