Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phanatic/khanacademyjs
A nodejs library for interacting with the Khan Academy APIs
https://github.com/phanatic/khanacademyjs
atom education
Last synced: 3 months ago
JSON representation
A nodejs library for interacting with the Khan Academy APIs
- Host: GitHub
- URL: https://github.com/phanatic/khanacademyjs
- Owner: Phanatic
- License: mit
- Created: 2016-08-25T03:17:04.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T10:26:33.000Z (about 2 years ago)
- Last Synced: 2024-04-14T05:30:41.963Z (9 months ago)
- Topics: atom, education
- Language: JavaScript
- Size: 454 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 12
-
Metadata Files:
- Readme: README.MD
- License: License
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
### Khan Academy JS
*Node.JS SDK for interacting with Khan Academy APIs*#### Install this package.
``` javascript
npm install khanacademyjs --save
```### SDK documentation
* [Badges](#badges)
* [Videos](#videos)
* [Exercises](#exercises)**Retrieve a list of all badges**
``` javascript
var khanJS = require('khanacademyjs');
khanJS.badges.getBadges((err, response, badges)=>{
console.log(`Found ${badges.length} badges`);
});
```###### Sample badge object
``` json
{
"badge_category": 1,
"description": "Going Transonic",
"name": "greattimedproblembadge",
"points": 500,
"safe_extended_description": "Quickly & correctly answer 10 exercise problems in a row (time limit depends on exercise difficulty)",
"user_badges": [
{
"badge_name": "greattimedproblembadge",
"date": "2011-05-04T06:02:05Z",
"kind": "UserBadge",
"points_earned": 500,
"target_context": {
},
"target_context_name": "Addition 1",
"user": "[email protected]"
}
]
}
```**Retrieve a list of all badge categories.**
``` javascript
var khanJS = require('khanacademyjs');
khanJS.badges.getBadgeCategories((err, response, categories)=>{
console.log(`Found ${categories.length} categories`);
});
```###### Sample badge category object
``` json
{
"category": 0,
"chart_icon_src": "/images/badges/meteorite-small-chart.png",
"description": "Meteorite badges are common and easy to earn when just getting started.",
"icon_src": "/images/badges/meteorite-small.png",
"large_icon_src": "/images/badges/meteorite.png",
"type_label": "Meteorite Badges"
}
```**Retrieve specific badge category identified by `categoryId`**
``` javascript
var khanJS = require('khanacademyjs');
khanJS.badges.getBadgeCategory(categoryId, (err, response, category)=>{
console.log(`Found category`, category);
});
```##### Retrieve the video identified by `readable_id` or `youtube_id`.
``` javascript
var khanJS = require('khanacademyjs');
khanJS.videos.getVideo(videoReadableId, (err, response, video)=>{
console.log(`Found video`, video);
});
```##### Retrieve a list of all exercises associated with video `video_id`.
``` javascript
var khanJS = require('khanacademyjs');
khanJS.videos.getExercises(videoReadableId, (err, response, exercises)=>{
console.log(`Found ${exercises.length} exercises`);
});
```##### Retrieve a filtered list of exercises in the library.
``` javascript
var khanJS = require('khanacademyjs');
khanJS.exercises.getExercises((err, response, exercises)=>{
console.log(`Found ${exercises.length} exercises`);
});
```##### Retrieve exercises identified by `exerciseName`.
``` javascript
var khanJS = require('khanacademyjs');
khanJS.exercises.getExercise(exerciseName, (err, response, exercises)=>{
console.log(`Found ${exercises.length} exercises`);
});
```##### Retrieve exercises identified by `exerciseName`.
``` javascript
var khanJS = require('khanacademyjs');
khanJS.exercises.getExercise(exerciseName, (err, response, exercise)=>{
console.log(`Found exercise`, exercise);
});
```##### Retrieve all the exercises that list `exerciseName` as a prerequisite.
``` javascript
var khanJS = require('khanacademyjs');
khanJS.exercises.getFollowupExercises(exerciseName, (err, response, followupExercises)=>{
console.log(`Found ${followupExercises.length} followup exercises`);
});
```##### Retrieve a list of videos associated with `exerciseName`.
``` javascript
var khanJS = require('khanacademyjs');
khanJS.exercises.getVideos(exerciseName, (err, response, videos)=>{
console.log(`Found ${videos.length} videos`);
});
```##### Retrieve a list of Perseus exercises used for autocomplete.
``` javascript
var khanJS = require('khanacademyjs');
khanJS.exercises.getPersusAutoComplete(exerciseName, (err, response, autoCompleteItems)=>{
console.log(`Found ${autoCompleteItems.length} autocomplete items`);
});
```