duolingo-api-js
v0.0.5
Published
Unofficial Duolingo API for browser, react-native, and nodejs
Downloads
8
Maintainers
Readme
duolingo-js
Unofficial Duolingo API for browser and nodejs. This repo is heavily inspired by the Unofficial Python API found here. Credit to those folks. All http requests to duolingo return promises. Please read the documentation to find out which are and which are not promises.
I just started this wrapper for a side project. I will be updating the README and project as I go.
Make sure you use "type": "module" in your package.json
Installation
install with npm
npm install duolingo-api-js
Usage
import Duolingo from "duolingo-api-js";
const duo = new Duolingo({userName:'acspock', password:'password'});
duo.logIn()
.then((result) => {
duo.getData()
.then(data => {
//use returned data or use userData on duo instance
console.log(duo.userData)
})
.catch(e => {
//handle error
});
})
.catch();
Documentation
Methods
- Login
- Get Data
- Get Languages
- Switch Language
- Get User Data
- Get Skills
- Get Learned Skills
- Get Learned Words
- Get Related Words
- Get Known Topics
- Get User Data Keys
- Is Current Language
Get User Information
duo.logIn()
Logs a user in
// Sample Request
duo.logIn()
.then( data => {
console.log('data', data);
})
.catch();
// Sample Response
{ response: 'OK', username: 'acspock', user_id: '11111' }
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.