An open API service indexing awesome lists of open source software.

https://github.com/bn3t/udemy-dl-rs

Download udemy courses in batch.
https://github.com/bn3t/udemy-dl-rs

cli rust-lang udemy

Last synced: about 1 year ago
JSON representation

Download udemy courses in batch.

Awesome Lists containing this project

README

          

# Download udemy courses in batch. [![Build Status](https://travis-ci.org/bn3t/udemy-dl-rs.svg?branch=develop)](https://travis-ci.org/bn3t/udemy-dl-rs)

# Usage

A cross-platform utility written in Rust to download courses from udemy for personal offline use.

## Features

- List down course contents and video resolution (option: `info`).
- Download specific chapter in a course (option: `-c / --chapter`).
- Download specific lecture in a chapter (option: `-l / --lecture`).
- Automatically pickup the best resolution for video download.
- Download lecture(s) requested resolution (option: `-q / --quality`).
- Download course to user requested path (option: `-o / --output`).
- Mark complete chapters or individual lectures as complete.
- Authentication token (option: `-t / --access-token`).

## Authentication Details

Authentication is only supported via the usage of an _Access Token_. The following paragraph details how to obtain such a token.

### Extracting your Access Token

- Open developer tools on your browser and access the **Network Tab**.
- Login to your udemy account.
- Check the network tab, you can filter on XHR requests to make the following easier.
- Right click on request links to **udemy.com/api-2.0/**. Check the request cookies and find one named _access_token_. Copy its value. This is your access token.

## Example Usage

### Obtain information from a course

udemy-dl-rs -u COURSE_URL -t YourAccessToken info

### Download a course to current diretory

udemy-dl-rs -u COURSE_URL -t YourAccessToken download

### Download a course to a specific directory

udemy-dl-rs -u COURSE_URL -t YourAccessToken download -o ~/Downloads

### Download a course to a specific directory with a specific quality

udemy-dl-rs -u COURSE_URL -t YourAccessToken download -o ~/Downloads -q 720

### Download a specific chapter

udemy-dl-rs -u COURSE_URL -t YourAccessToken download -o ~/Downloads -c 1

### Download a specific lecture from a chapter

udemy-dl-rs -u COURSE_URL -t YourAccessToken download -o ~/Downloads -c 8 -l 77

Note: The lecture number is it's index in the overall course. Use info to know more.

## Command Line Usage

### General Usage

```
$ udemy-dl-rs --help
Udemy Downloader 0.10.0
Bernard Niset

USAGE:
udemy-dl-rs [FLAGS] --access-token --url

FLAGS:
-h, --help Prints help information
-V, --version Prints version information
-v Sets the level of verbosity

OPTIONS:
-t, --access-token Access token to authenticate to udemy
-u, --url URL of the course to download

SUBCOMMANDS:
complete Mark courses as completed
download Download course content
help Prints this message or the help of the given subcommand(s)
info Query course information

Build: 814815c - 2019-09-07
```

### Subcommand Usage - info

```
$ udemy-dl-rs info --help
udemy-dl-rs-info
Query course information

USAGE:
udemy-dl-rs --password --url --username info

FLAGS:
-h, --help Prints help information
-V, --version Prints version information
```

### Subcommand Usage - download

```
$ udemy-dl-rs download --help
udemy-dl-rs-download
Download course content

USAGE:
udemy-dl-rs --password --url --username download [FLAGS] [OPTIONS]

FLAGS:
-d, --dry-run Dry run, show what's would be done but don't download anything.
-h, --help Prints help information
-V, --version Prints version information

OPTIONS:
-c, --chapter Restrict downloads to a specific chapter.
-l, --lecture Restrict download to a specific lecture.
-o, --output Directory where to output downloaded files (default to .). [default: .]
-q, --quality Download specific video quality.
```

### Subcommand Usage - complete

```
$ udemy-dl-rs complte --help
udemy-dl-rs-complete
Mark courses as completed

USAGE:
udemy-dl-rs --password --url --username complete [OPTIONS] --chapter

FLAGS:
-h, --help Prints help information
-V, --version Prints version information

OPTIONS:
-c, --chapter Restrict marking a specific chapter.
-l, --lecture Restrict marking a specific lecture.
```

## To do

- Resume capability for a course video.
- Supports organization and individual udemy users both.
- Download subtitles for a video.
- Download chapter(s) by providing range in a course.
- Download lecture(s) by providing range in a chapter.

# Development Guidelines

## Unit tests

Install cargo watch

cargo install cargo-watch

Run unit tests. Unit tests need to run single threaded.

cargo test -- --test-threads=1

Run unit tests with watch

cargo watch -w src -x "test -- --test-threads=1"

## Run info command

cargo run -- -u https://www.udemy.com/css-the-complete-guide-incl-flexbox-grid-sass -t YourAccessToken info

## Run download command

cargo run -- -u https://www.udemy.com/css-the-complete-guide-incl-flexbox-grid-sass -t YourAccessToken download -c 1

## Run download command to a location ~/Downloads

cargo run -- -u https://www.udemy.com/css-the-complete-guide-incl-flexbox-grid-sass -t YourAccessToken download -c 1 -o ~/Downloads