Created
July 18, 2013 06:57
-
-
Save muzizongheng/6027232 to your computer and use it in GitHub Desktop.
loop to get evernote's notes
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
# List all of the notebooks in the user's account | |
notebooks = noteStore.listNotebooks(authToken) | |
print("Found ", len(notebooks), " notebooks:") | |
#calculate processed blog count currently | |
processedBlogCount = 0 | |
for notebook in notebooks: | |
print(" * ", notebook.name) | |
if notebook.name != evernote.syncNotebook: | |
continue | |
filter = NoteStore.NoteFilter() | |
filter.notebookGuid = notebook.guid | |
noteCount = noteStore.findNoteCounts(authToken, filter, False).notebookCounts[notebook.guid] | |
print("Find note counts: %i of %s, guid is: %s"%(noteCount, notebook.name, notebook.guid)) | |
#create blog category by tags | |
if evernote.isCreateTags == True: | |
tagslist = noteStore.listTagsByNotebook(authToken, notebook.guid) | |
#convert tags to categories | |
categories = evernote.convertTags2Category(tagslist) | |
try: | |
for c in categories: | |
metaweblog.new_category(c) | |
print("create blog's category: ", c.name) | |
except Exception as err: | |
print("Create category failed: ", err) | |
finally: | |
pass | |
#set note offset to loop find | |
nextOffset = 0 | |
while nextOffset < noteCount: | |
noteList = noteStore.findNotes(authToken, filter, nextOffset, noteCount) | |
print("Get %i notes, currrent note offset: %i\n"%(len(noteList.notes), nextOffset)) | |
#increase offset for next find | |
nextOffset += len(noteList.notes) | |
#print noteList | |
for n in noteList.notes: | |
print(n.title) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment