Skip to content

Commit

Permalink
fix: empty pdf in bun.
Browse files Browse the repository at this point in the history
- remove config.json and use .env file
- terminate process if ctrl+c is pressed
- minor changes
  • Loading branch information
shihabmridha committed Apr 13, 2024
1 parent 9620afd commit 8d22430
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 2,796 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
EMAIL=[email protected]
PASSWORD=password
SKIP_LOGIN=false
SAVE_AS=pdf
MULTI_LANGUAGE=false
HEADLESS=false
COURSE_URL=https://www.educative.io/courses/learn-intermediate-java
DOWNLOAD_ALL=false
66 changes: 1 addition & 65 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,69 +1,5 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# Compiled TypeScript
build

#apidoc
apidoc

.DS_Store

node_modules/
data
downloads
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ This tool is to download course from for later usage. It uses your login credent
## 💡 Usage
- Clone the project and navigate into it.
- `bun install` to install dependencies.
- Open ___config/default.json___ file to set configurations. (Email, Password, Course URL).
- Create a file named `.env` and set configs (Email, Password, Course URL). See the `.env.example` for reference.
- `bun start` to start download.

## ⚙️ CONFIG
Config file (___config/default.json___) has the following properties.
- email: Your subscription email.
- password: Your subscription password.
- courseUrl: The course you wanna download.
- 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
Config file `.env` has the following properties.
- EMAIL: Your subscription email.
- PASSWORD: Your subscription password.
- COURSE_URL: The course you wanna download.
- SKIP_LOGIN: 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.
- MULTI_LANGUAGE: A lesson can contains code snippets in multiple programming languages. Set this to `true` to download snippets in all available language. Default is `false`.
- SAVE_AS: Available options: ___`pdf` and `html`___. Default is ___`html`___.
- HEADLESS: Browser mode. Default is `false`.
- DOWNLOAD_ALL: Download all available courses for the account

> IMPORTANT: If you save as html it is actually gonna save as mhtml.
Expand All @@ -37,7 +37,7 @@ Config file (___config/default.json___) has the following properties.
- Open configuration.ts and increase the value of `_httpTimeout`. Default is 30000ms.

**DOWNLOAD EMPTY PAGE?**
- Verify your login credentials and set `skipLogin: true`.
- Verify your login credentials and set `SKIP_LOGIN = true`.
- Make sure you are logged in.

**FORCE LOGIN? LOGIN TO ANOTHER ACCOUNT?**
Expand Down
Binary file modified bun.lockb
100644 → 100755
Binary file not shown.
10 changes: 0 additions & 10 deletions config/default.json

This file was deleted.

Loading

0 comments on commit 8d22430

Please sign in to comment.