A script to collect your and your friends' duolingo experience metrics and send them to your Datadog dashboards.
- Simple metric: only total xp is collected. This metric is tagged by
friend
andweek_day
. - Detailed metrics: xp by language, language level and xp required to get to the next level are also collected. These additional metrics are scraped from public duolingo profile pages. Thus the selenium module and a browser to be driven by selenium are required. These metrics are tagged by
friend
,week_day
andlanguage
.
pip install datadog, duolingo-api
# pip install selenium # if you want detailed metrics
git clone https://github.com/MartiFlex/Lingodog.git
cd Lingodog/
- Edit lingodog.conf. At least enter your datadog api_key and your duolingo username and password.
- Run
python run_config.py
to:
- check the config
- run metric collection once
If you're running Linux, schedule a cronjob to collect metrics every 10 minutes or so:
(echo "*/10 * * * * $(which python) $(pwd)/lingodog.py"; crontab -l) | crontab -
Otherwise use launchctl (Mac) or Windows Task Scheduler (Windows).
api_key
(Datadog), username
, password
(Duolingo)
The language_details
parameter activates detailed metric collection. If omitted, it defaults to False.
If language_details = True, browser name & executable_path are required for Selenium:
browser
should exactly match one of the following names: PhantomJS or Chrome or Firefox.executable_path
:- Firefox: no executable needed. Just install Firefox on your machine.
executable_path = .
(or any value of your choice) - Chrome: install Chrome + chromedriver (https://sites.google.com/a/chromium.org/chromedriver/home).
executable_path= relative_or_absolute_path_to_your_chromedriver_file
- PhantomJS: just get a PhantomJS executable (here for instance: https://github.com/eugene1g/phantomjs/releases).
executable_path= relative_or_absolute_path_to_your_phantomjs_file
- Firefox: no executable needed. Just install Firefox on your machine.
Example:
language_details = True
browser = PhantomJS
executable_path = ./webdrivers/phantomjs
- Change reporting metric names: parameters
total_xp
,language_xp
,language_level
,language_xp_for_next_level
- Change Log level and log file location:
log_level
(set it up toDEBUG
to get more logging),log_filepath