Skip to content

Commit

Permalink
Revive the project
Browse files Browse the repository at this point in the history
- Fix login (with MFA)
- Download single course
- Massive code refactor
- New tools (latest node, eslint, pnpm etc)
  • Loading branch information
shihabmridha committed Dec 11, 2023
1 parent 3f7123d commit 50e2686
Show file tree
Hide file tree
Showing 15 changed files with 2,781 additions and 862 deletions.
21 changes: 21 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"semi": ["error"]
}
}
5 changes: 4 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"skipFiles": [
"${workspaceFolder}/node_modules/**/*.js",
"<node_internals>/**"
]
],
"env": {
"NODE_PATH": "."
}
},
]
}
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# !! Discontinued !!

<br>

## [😍 SUPPORT](https://www.educative.io?aff=xkwW)
Help maintaning this project by showing your support. Use **[this affiliate link](https://www.educative.io?aff=xkwW)** for future purchase.
Help maintaning this project by showing your support. Use **[this affiliate link](https://www.educative.io?aff=xkwW)** for future purchase.

## ✉️ Description
This tool is to download course from for later usage. It uses your login credentials and download the course.
Expand All @@ -12,36 +8,39 @@ This tool is to download course from for later usage. It uses your login credent
- You need a subscription to use this.
- Might not work in WSL

# Prerequisite
- Node.js (tested version: 20.10.0)
- PNPM package manager

## 💡 Usage
- Install typescript cli.
- Clone the project and navigate into it.
- `npm install` to install dependencies.
- `pnpm install` to install dependencies.
- Open ___config/default.json___ file to set configurations. (Email, Password, Course URL).
- `npm run compile` to compile typescript.
- `npm start` to start download.
- `pnpm compile` to compile typescript.
- `pnpm start` to start download.

> IMPORTANT: If you make changes to the code, make sure to compile it.
## ⚙️ CONFIG
Config file (___config/default.json___) has the following properties.
- email: Your subscription email.
- password: Your subscription password.
- loginCheck: By default, before downloading a course we check if you are already logged in. If you are sure that you are already logged in then you can set this value to ___false___ to skip login check. Recommended value: `true`.
- skipLogin: By default, before downloading a course we check if you are already logged in. If you are sure that you are already logged in then you can set this value to ___false___ to skip login check.
- multiLanguage: A lesson can contains code snippets in multiple programming languages. Set this to `true` to download snippets in all available language. Default is `false`.
- saveAs: Available options: ___`pdf` and `html`___. Default is ___`html`___.
- headless: Browser mode. Default is `false`.
- downloadAll: Download all available courses for the account

> IMPORTANT: If you save as html it is actually gonna save as mhtml.

## 🛠 TROUBLESHOOT

**NAVIGATION TIMEOUT (Or, some other timeout)?**
- Open globals.ts and increase the value of `HTTP_REQUEST_TIMEOUT`. Default is 30000ms.
- Open configuration.ts and increase the value of `_httpTimeout`. Default is 30000ms.

**DOWNLOAD EMPTY PAGE?**
- Verify your login credentials and set `loginCheck: true`.
- Open ___browser.ts___ file and find `launchBrowser()` and set ` headless: false` to see live actions.
- Verify your login credentials and set `skipLogin: true`.
- Make sure you are logged in.

**FORCE LOGIN? LOGIN TO ANOTHER ACCOUNT?**
Expand Down
6 changes: 3 additions & 3 deletions config/default.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"email": "[email protected]",
"password": "yourPassword",
"loginCheck": true,
"skipLogin": true,
"saveAs": "html",
"multiLanguage": false,
"headless": true,
"headless": false,
"courseUrl": "https://www.educative.io/courses/grokking-the-behavioral-interview",
"downloadAllCourses": false
"downloadAll": false
}
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
{
"name": "educative.io-downloader",
"version": "1.0.0",
"version": "2.0.0",
"description": "Download course from educative.io",
"main": "app.js",
"main": "build/app.js",
"dependencies": {
"config": "^3.2.4",
"puppeteer": "^2.0.0"
"puppeteer": "^21.5.2"
},
"devDependencies": {
"@types/node": "^13.1.7",
"@types/puppeteer": "^2.0.0",
"@types/config": "^0.0.36"
"@types/config": "^3.3.3",
"@types/node": "^20.10.0",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"cross-env": "^7.0.3",
"eslint": "^8.55.0",
"typescript": "^5.3.2"
},
"scripts": {
"start": "node build/src/app.js",
"start": "cross-env NODE_PATH=. node build/src/app.js",
"dev": "nodemon build/src/app.js",
"compile": "tsc -p .",
"test": "echo \"Error: no test specified\" && exit 1"
"compile:watch": "tsc -w"
},
"author": "Shihab Mridha",
"license": "ISC"
Expand Down
Loading

0 comments on commit 50e2686

Please sign in to comment.