0.4.1 • Published 3 years ago

@grimille/duolingo-js v0.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@grimille/duolingo-js 2021 UPDATE

Use the Duolingo API and power up your Node.js application (non-official) This is WIP, feel free to contact me for additions or any issues. 🦉

Installation

Use npm to install this dependency. ⬇️⬇️⬇️

npm install @grimille/duolingo-js

Usage

Start by creating a client :

const { Duolingo } = require('@grimille/duolingo-js');
const client = new Duolingo(<username|email>, <password>);

And use async IFEE :

// ...
(async() => {
	// your code here
	
	let logged  =  await client.login(); // True / false
	let totalXP = client.getTotalXP(); //Get your total XP
	
	await client.setUser('RandomUser');
	
	totalXP = client.getTotalXP(); //Get "RandomUser"'s total XP
})();

Notice: If you don't use async, you'll block your main thread during querying.

Avalaible Methods

Retrieving the data asynchronously

  • loadSelfUserData() - Reload your own Duolingo data is the API. Done by default when login.
  • getUserData(username) - Get the full JSON payload of a Duolingo user.
  • setUser(username) - Load a user into the API (cache the data)

Using the cache when retrieved

  • getXpGoal() - Get the XP Goal (could be undefined)
  • getTotalXP() - Get the total XP earned of all courses
  • getStreak() - Get the current streak
  • getUsername() - Get the username
  • getDisplayName() - Get the display name
  • isPremium() - Get if the user is premium (Duolingo Plus) or not.

Todos

  • Implement new API calls (Buy a freeze… 👀)
  • More testing and more support
  • Tell me your needs

Links

Contributing

No contributions for the moment as the API is in working progress.

License

MIT

0.4.1

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.3.1

3 years ago

0.1.5

3 years ago

0.1.3

3 years ago

0.2.1

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago