Duolingo Flashcards

July 3, 2022

Duolingo Flashcards

Long Intro

You may — or may not — know me, but let me tell you one of my passion in life: connect everything together.

When I was young — let's say 15 — I tried to connect a landline phone to my computer sound card, learning a lesson here: landline in France carry a bit of electricity and my computer did not like it. I had to play without sound for a while.

I also have a project in the work about connecting plants to synthesizers, so we could hear them grow — but I have yet to find more time to work on it.

And of course, a part of my job is to connect programs (APIs) together to build products and services.

Anyway, today I'm going to talk about a more down to earth usage, hacky one, but a need I had.

I'm trying to learn a new language (Spanish) mostly for fun and brain practice. And for that, I'm using the app Duolingo. It's good (for now) but it does not have a feature I love: flashcards.

A flashcard is a card bearing information on both sides, which is intended to be used as an aid in memorization. Each flashcard bears a question on one side and an answer on the other. Flashcards are often used to memorize vocabulary, historical dates, formulas or any subject matter that can be learned via a question-and-answer format. Flashcards can be virtual (part of a flashcard software), or physical. Wikipedia

On the other side, it exists free flashcard apps like: Ankiapp that allows user to make their own flashcard set, and even in that case, import CSV into it.

Say no more, let's connect those together.

Connect Everything

First, I need an API point on the Duolingo part, but unfortunately, it does not exist… The internet being a magic place full of ressources, I found someone working on an unofficial API. Thank you, @KartikTalwar, for github.com/KartikTalwar/Duolingo.

I took me sometime to explore the API (without doc) and found some endpoints that would do the job.

The next step is the easy one, take my favorite scripting language PHP and build a CSV file from this info. After a bit of test, it works as expected, I cleaned up the whole projet and decided to put it online, so you could use it too.

Find it here github.com/jrmgx/duo-vocabulary you have all the information to use it on the repository. It's easy with docker, you don't have to install anything docker run jrmgx/duo-vocabulary [parameters] > output.csv

Limitations

  • It has some specific hardcoded rules to remove feminine and plural words, but those rules only work for Spanish (the language I'm learning right now).
  • Duolingo does not provide an official API, for that reason, it may stop working at anytime (without any way to fix it).
  • From what I understood, calls to dictionary/hints endpoint are limited in payload size, it may have to be split at some point, but for now, with my current usage it works like that.

Update

I made a telegram bot that can handle those CSV to be used as a flashcard bot

Enjoy!