Catch.com to Evernote migration

I have been using catch notes for the past 2 years. When I knew the news about catch notes shutting down “Catch will no longer be available after 30 August 2013.”, I started looking for alternatives. One of the best alternative is evernote. Though I have tried few years ago, but I havent used it effectively.

http://support.catch.com/customer/portal/articles/988949-how-can-i-export-notes-on-the-web-interface-

As per the above URL, exported my notes from catch.com

http://support.catch.com/customer/portal/articles/1243609-importing

Though the exported data contains enex file to import into Evernote. It does not automatically add the pictures and tags.

As I had only few pictures in my notes, I manually added it to the notes in Evernote. But I had around 800 notes, I dont want to tag each and every note manually. So I wrote a simple python script to convert all the #tag to evernote tags.

Check the gist at https://gist.github.com/ramandv/6146111

from evernote.api.client import NoteStore
from evernote.api.client import EvernoteClient

#Get your dev token from the following URL
#https://www.evernote.com/api/DeveloperToken.action

dev_token = "<your api token>"
client = EvernoteClient(token=dev_token, sandbox=False)
noteStore = client.get_note_store()


filter = NoteStore.NoteFilter()

#Find the guid of your catch notebook, by selecting the catch notebook and see the URL
#https://www.evernote.com/Home.action#b=<guid>
filter.notebookGuid = "<catch_notebook_guid>"

spec = NoteStore.NotesMetadataResultSpec()
spec.includeTitle = True
spec.includeTagGuids = True

index = 0
while True:
    noteList = noteStore.findNotesMetadata( dev_token, filter, index, 50, spec)
    for note in noteList.notes:
        index = index + 1
        if (note.tagGuids != None and len(note.tagGuids) > 0):
            print "already tags present, so skipping...."
            print "--------------[" + str(index) + "]"
            continue

        note = noteStore.getNote(dev_token, note.guid, True, True, True, True)
        content = note.content
        print 'Title:', note.title,
        print 'Content:', content
        print "--------------[" + str(index) + "]"
        titlecontent = note.title + " " + content

        #Remove HTML tags
        titlecontent = re.sub('<[^<]+?>', ' ', titlecontent)

        #get tags
        tags = [word for word in titlecontent.split() if word.startswith('#') and len(word) > 1]

        #remove unwanted characters
        tags = [word.strip(" #;.,").lower() for word in tags ]
        tags = [word.split()[0] for word in tags if len(word.split()) > 0 ]
        tags = [word.strip(" #;.,") for word in tags if len(word.strip(" #;.,")) > 0 ]

        #remove duplicate tags
        tags_set = set(tags)
        tags = list(tags_set)

        #Add tags only if the actual note does not contain tags
        if len(tags) > 0 and (note.tagNames == None or len(note.tagNames) == 0):
            print "[" + str(index) + "]###########" + str(tags)
            note.tagNames = tags
            noteStore.updateNote(dev_token, note)

    if noteList.totalNotes <= index:
        break;
    print "FETCHING NEXT PAGE======================="
This entry was posted in python and tagged , . Bookmark the permalink.

7 Responses to Catch.com to Evernote migration

Leave a Reply

Your email address will not be published. Required fields are marked *