Unofficial Udacity API (for Node.js)
by Ty-Lucas Kelley
## ## ##### #### ##### ###### ###### ## ##
## ## ## # ## ## ## ## ## ## ##
## ## ## # ###### ## ## ## ####
## ## ## # ## ## ## ## ## ##
#### ##### ## ## ##### ###### ## ##
This is an unofficial client library for interacting with Udacity courses and users. It is made up of two parts:
- Catalog
- A wrapper for Udacity's public Catalog API
- User
- Log into your Udacity account, see user info, and check course progress
Warning
Note that this is not an official Udacity product. They are allowed to change their internal API at any time, and I will try my best to make sure this library gets updated as well.
In the end, be sure to use this only for personal purposes, not any serious application with a lot of users.
Installation
It's on npm! Just install it from the terminal:
$ npm install udacity-api
You can then include it in your application:
var Catalog = Catalog;var User = User;
User
The User
object can be used to view a user's account info and see their
progress in courses. It includes a lot of convenience functions.
User(email, password)
Create a new user.
Example
var me = 'me@example.com' 'password123';
account(cb)
Get a user's account information.
Arguments
- cb {function} - Callback function
Example
me;
key(cb)
Get a user's Udacity ID.
Arguments
- cb {function} - Callback function
Example
me;
name(cb)
Get a user's first and last name.
Arguments
- cb {function} - Callback function
Example
mename { console;};
nickname(cb)
Get a user's nickname.
Arguments
- cb {function} - Callback function
Example
me;
email(cb)
Get a user's email address.
Arguments
- cb {function} - Callback function
Example
me;
emailPreferences(cb)
Get a user's preferences for mailing lists and data sharing.
Arguments
- cb {function} - Callback function
Returns
An object like this:
employer_sharing: false newsletter: false course_emails: true user_research: true
Example
me;
sitePreferences(cb)
Get a user's preferences for website functionality (like video playback speed).
Arguments
- cb {function} - Callback function
Returns
An object like this:
auto_advance: false video_quality: "normal" use_html5_player: true playback_rate: 1
Example
me;
enrollments(cb)
Get an array of all courses a user is a part of.
Arguments
- cb {function} - Callback function
Example
me;
progress(id, cb)
Get information about progress in a course.
Arguments
- id {string} - Course key (ex. "cs101")
- cb {function} - Callback function
Returns
An object like this:
"key":"cs101" "title":"Intro to Computer Science" "quiz_count":221 "morsel_count":521 "completed":false "quizzes_completed":1 "morsels_completed":3 "last_visited":"2014-11-27T01:02:29.517Z" "time_away_ms":9316178 "most_recent_url":"https://www.udacity.com/course/viewer#!/c-cs101/l-48299949/e-48709295/m-48700438" "current_lesson": "key":"48299949" "quizzes_completed":1 "morsels_completed":3 "completed":false "title":"Lesson 1: How to Get Started" "quiz_count":22 "morsel_count":64
Example
me;
clear()
Clear the cache.
Example
meclear;
Catalog
The Catalog
object can be used to filter data from Udacity's Catalog API.
It has a bunch of convenience functions:
Catalog()
Create a new catalog.
Example
var cat = ;
catalog(cb)
Get all catalog data.
Arguments
- cb {function} - Callback function
Example
var cat = ; cat;
courses(cb)
Get all courses.
Arguments
- cb {function} - Callback function
Example
var cat = ; cat;
course(id, cb)
Get one course.
Arguments
- id {string} - Course key
- cb {function} - Callback function
Example
var cat = ; cat;
instructors(id, cb)
Get the instructor(s) for one course.
Arguments
- id {string} - Course key
- cb {function} - Callback function
Example
var cat = ; cat;
tracks(cb)
Get all tracks.
Arguments
- cb {function} - Callback function
Example
var cat = ; cat;
track(name, cb)
Get one track.
Arguments
- name {string} - Track name
- cb {function} - Callback function
Example
var cat = ; cat;
degrees(cb)
Get all nanodegrees.
Arguments
- cb {function} - Callback function
Example
var cat = ; cat;
degree(id, cb)
Get one nanodegree.
Arguments
- id {string} - Nanodegree key
Example
var cat = ; cat;
clear()
Clear the cached catalog data.
Example
var cat = ; catclear;
Contributing
I accept pull requests! Between school, work, and life I can only put in so much time on this project, so all help is appreciated.
Check out TODO.md for some things I've been meaning to get done but haven't.