Copycat Importer (AnkiApp/AnkiPro)

Someone asked me to help him export his decks from AnkiApp. I found that the zip export feature is paywalled now, and after reading this Reddit post, I managed to extract the cards’ data from the local database file and thought of releasing the code as an add-on. So here you go: https://ankiweb.net/shared/info/2072125761

GitHub repo: GitHub - abdnh/anki-copycat-importer: Anki add-on to import decks from copycat apps such as AnkiApp and AnkiPro

I hope this will be helpful.

23 Likes

Great work Abdo, I imagine this will be a big relief to users who want to move away from AnkiApp. I’ve added a link to the add-on in the FAQ entry.

5 Likes

Hey Abdo, thanks for making this tool. I’m trying to get out of the AnkiApp ecosystem as well, but for some reason when I access the database folder through the add-on it doesn’t let me select the only file there as it’s greyed out (titled “1”).

I’m on Mac in case that changes anything. Any ideas as to what could be causing the problem?

Hmm, the add-on should allow all kinds of files (It actually tries to access whatever you give it).

I suspect this is Mac-related, as I can select any file according to my tests on Windows. I don’t have access to a Mac to confirm this. Can you select any other file, like the Databases.db file outside the file__0 directory? The Databases.db doesn’t contain your cards. I’m just asking to see if the problem is possibly related to file extensions. You can try renaming the 1 file to something like 1.db to see if that fixes the problem. See https://www.howtogeek.com/714021/how-to-show-all-filename-extensions-on-the-mac/ if file extensions are hidden on your Mac.

2 Likes

Renaming the file to “1.db” did the trick. Thanks a lot!

And yeah, previously it was only the “1” file that was greyed out, others like “Databases.db” could always be selected.

1 Like

Hey. I tried to import my flash cards from Ankiapp to Ankiweb but I still have an error message when I used the « greffon ». Can you help me?

I sent you the message (sorry it is in French)

Erreur
Une erreur est survenue. Veuillez démarrer Anki en maintenant la touche majuscule enfoncée, ce qui désactivera temporairement les greffons que vous avez installés.
Si le problème ne survient que lorsque les greffons sont activés, veuillez utiliser le menu Outils > Greffons afin de désactiver certains greffons. Redémarrez Anki jusqu’à ce que vous découvriez le greffon qui cause le problème.
Une fois ce greffon découvert, merci de signaler le problème sur le site de support du greffon.
Information de débogage :
Anki 2.1.49 (dc80804a) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.16
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-02-13 09:50:48
Greffons possiblement impliqués : ⁨AnkiApp Importer⁩

Caught exception:
Traceback (most recent call last):
File “aqt/utils.py”, line 465, in accept
File “/Users/julie/Library/Application Support/Anki2/addons21/2072125761/init.py”, line 9, in import_from_ankiapp
importer = AnkiAppImporter(filename)
File “/Users/julie/Library/Application Support/Anki2/addons21/2072125761/ankiapp_importer.py”, line 83, in init
self._extract_notetypes()
File “/Users/julie/Library/Application Support/Anki2/addons21/2072125761/ankiapp_importer.py”, line 90, in _extract_notetypes
for row in self.cur.execute(“SELECT * FROM layouts”):
sqlite3.DatabaseError: file is not a database

Did you select the file inside the databases folder (Probably named 1 or something like file__0)?

Hi!
Thank you so much for figuring this out.
However, it does not seem to work for me. I do get the message “imported successfully” but after this I don’t see any decks being added.
Do you happen to have any idea how I could solve this?

NVM it worked now! The only thing is that all the cards are double, as the AnkiApp probably saves all the cards as front-back and back-front.

1 Like

Hi there - I’m trying to use the importer so I can move away from AnkiApp but getting the following error (looks like it’s to do with the media files?) Any help would be greatly appreciated:
Debug info:
Anki 2.1.49 (dc80804a) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-03-04 22:33:32

Caught exception:
Traceback (most recent call last):
File “aqt\utils.py”, line 465, in accept
File “C:\Users\P\AppData\Roaming\Anki2\addons21\2072125761_init_.py”, line 10, in import_from_ankiapp
importer.import_to_anki(mw)
File “C:\Users\P\AppData\Roaming\Anki2\addons21\2072125761\ankiapp_importer.py”, line 165, in import_to_anki
filename = mw.col.media.write_data(media.id + media.ext, media.data)
TypeError: can only concatenate str (not “NoneType”) to str

Thank you for the report! Would you mind sharing your AnkiApp collection so I can debug the issue? I believe the add-on is failing to handle some media types.
You can upload the database file to a service like https://gofile.io/ and post a link here (or in a private message).

Hi Abdo, it turns out I can’t send a private message, so the suffix for the gofile link is here - d/5YWeNo (AnkiWeb won’t allow me to send the full link for some reason)

Apologies in advance, the collection is quite big :frowning:

WebP images were not being recognized by the add-on. I pushed an update that should fix the issue.

I also discovered another issue that could have prevented you again from importing your cards: Some card fields were mysteriously filled with data but are not actually shown when browsing the cards in AnkiApp. I suspect this is caused by moving a card from one deck to another, which can cause problems (As AnkiApp warns) because AnkiApp apparently associates each deck with a single layout (notetype in Anki’s terminology).

After importing to Anki, you should notice that some previously empty fields have contents now (e.g. see the “太空” card, which has “?” in its “Question” field that doesn’t appear in AnkiApp).

1 Like

Importing may take a while with your large collection and Anki may not respond meanwhile.
(I guess I should add a progress dialog).

1 Like

Thanks for your help Abdo! This works well now

Hi there,

I am having an issue important my AnkiApp deck(s). I get the following error message:

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you’ve discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.49 (dc80804a) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-04-08 07:05:33

Caught exception:
Traceback (most recent call last):
File “aqt\taskman.py”, line 101, in on_closures_pending
File “aqt\taskman.py”, line 71, in
File "C:\Users\mjpaw\AppData\Roaming\Anki2\addons21\2072125761_init
.py", line 25, in on_done
count = fut.result()
File “concurrent\futures_base.py”, line 432, in result
File “concurrent\futures_base.py”, line 388, in _get_result
File “concurrent\futures\thread.py”, line 57, in run
File "C:\Users\mjpaw\AppData\Roaming\Anki2\addons21\2072125761_init
.py", line 21, in start_importing
return importer.import_to_anki(mw)
File “C:\Users\mjpaw\AppData\Roaming\Anki2\addons21\2072125761\ankiapp_importer.py”, line 203, in import_to_anki
card.fields[field_name] = BLOB_REF_RE.sub(
File “C:\Users\mjpaw\AppData\Roaming\Anki2\addons21\2072125761\ankiapp_importer.py”, line 204, in
lambda m: repl_blob_ref(self, m), contents
File “C:\Users\mjpaw\AppData\Roaming\Anki2\addons21\2072125761\ankiapp_importer.py”, line 72, in repl_blob_ref
return fnameToLink(importer.media[blob_id].filename)
KeyError: ‘e407f7d3c1a0457fa1e3d8da3b333fde’

It only seems to import some of my cards/decks and they are oriented back-to-front, instead of front-to-back.

Can someone give me a hand?

(I didn’t get a notification of your post for some reason)

Can you share the deck? You can upload it to a website like https://gofile.io/ and post a link here.

The error points to missing media files in your collection. I can make the add-on handle this case gracefully (maybe informing the user about the issue).

1 Like

I am unable to past the link into my post

New users to the forums can’t post links. You can work around this by pasting the link as separate parts like gofile /d/abcd.

1 Like