@fredlackey/devutils 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/package.json +1 -1
- package/src/commands/install.js +374 -36
- package/src/installs/adobe-creative-cloud.js +527 -25
- package/src/installs/adobe-creative-cloud.md +605 -0
- package/src/installs/appcleaner.js +303 -26
- package/src/installs/appcleaner.md +699 -0
- package/src/installs/apt-transport-https.js +390 -0
- package/src/installs/apt-transport-https.md +678 -0
- package/src/installs/atomicparsley.js +624 -26
- package/src/installs/atomicparsley.md +795 -0
- package/src/installs/aws-cli.js +779 -26
- package/src/installs/aws-cli.md +727 -0
- package/src/installs/balena-etcher.js +688 -26
- package/src/installs/balena-etcher.md +761 -0
- package/src/installs/bambu-studio.js +912 -26
- package/src/installs/bambu-studio.md +780 -0
- package/src/installs/bash-completion.js +554 -23
- package/src/installs/bash-completion.md +833 -0
- package/src/installs/bash.js +399 -26
- package/src/installs/bash.md +993 -0
- package/src/installs/beyond-compare.js +585 -26
- package/src/installs/beyond-compare.md +813 -0
- package/src/installs/build-essential.js +511 -26
- package/src/installs/build-essential.md +977 -0
- package/src/installs/ca-certificates.js +618 -0
- package/src/installs/ca-certificates.md +937 -0
- package/src/installs/caffeine.js +490 -26
- package/src/installs/caffeine.md +839 -0
- package/src/installs/camtasia.js +577 -25
- package/src/installs/camtasia.md +762 -0
- package/src/installs/chatgpt.js +458 -26
- package/src/installs/chatgpt.md +814 -0
- package/src/installs/chocolatey.js +447 -0
- package/src/installs/chocolatey.md +661 -0
- package/src/installs/chrome-canary.js +472 -26
- package/src/installs/chrome-canary.md +641 -0
- package/src/installs/chromium.js +645 -26
- package/src/installs/chromium.md +838 -0
- package/src/installs/claude-code.js +558 -26
- package/src/installs/claude-code.md +1173 -0
- package/src/installs/curl.js +361 -26
- package/src/installs/curl.md +714 -0
- package/src/installs/cursor.js +561 -26
- package/src/installs/cursor.md +970 -0
- package/src/installs/dbschema.js +674 -26
- package/src/installs/dbschema.md +925 -0
- package/src/installs/dependencies.md +435 -0
- package/src/installs/development-tools.js +600 -0
- package/src/installs/development-tools.md +977 -0
- package/src/installs/docker.js +1010 -25
- package/src/installs/docker.md +1109 -0
- package/src/installs/drawio.js +1001 -26
- package/src/installs/drawio.md +795 -0
- package/src/installs/elmedia-player.js +328 -25
- package/src/installs/elmedia-player.md +556 -0
- package/src/installs/ffmpeg.js +870 -25
- package/src/installs/ffmpeg.md +852 -0
- package/src/installs/file.js +464 -0
- package/src/installs/file.md +987 -0
- package/src/installs/gemini-cli.js +793 -26
- package/src/installs/gemini-cli.md +1153 -0
- package/src/installs/git.js +382 -26
- package/src/installs/git.md +907 -0
- package/src/installs/gitego.js +931 -26
- package/src/installs/gitego.md +1172 -0
- package/src/installs/go.js +913 -26
- package/src/installs/go.md +958 -0
- package/src/installs/google-chrome.js +801 -25
- package/src/installs/google-chrome.md +862 -0
- package/src/installs/gpg.js +412 -73
- package/src/installs/gpg.md +1056 -0
- package/src/installs/homebrew.js +1015 -26
- package/src/installs/homebrew.md +988 -0
- package/src/installs/imageoptim.js +950 -26
- package/src/installs/imageoptim.md +1119 -0
- package/src/installs/installers.json +2297 -0
- package/src/installs/jq.js +382 -26
- package/src/installs/jq.md +809 -0
- package/src/installs/keyboard-maestro.js +701 -26
- package/src/installs/keyboard-maestro.md +825 -0
- package/src/installs/latex.js +771 -26
- package/src/installs/latex.md +1095 -0
- package/src/installs/lftp.js +338 -26
- package/src/installs/lftp.md +907 -0
- package/src/installs/lsb-release.js +346 -0
- package/src/installs/lsb-release.md +814 -0
- package/src/installs/messenger.js +829 -26
- package/src/installs/messenger.md +900 -0
- package/src/installs/microsoft-office.js +550 -26
- package/src/installs/microsoft-office.md +760 -0
- package/src/installs/microsoft-teams.js +782 -25
- package/src/installs/microsoft-teams.md +886 -0
- package/src/installs/node.js +886 -26
- package/src/installs/node.md +1153 -0
- package/src/installs/nordpass.js +698 -26
- package/src/installs/nordpass.md +921 -0
- package/src/installs/nvm.js +977 -26
- package/src/installs/nvm.md +1057 -0
- package/src/installs/openssh.js +734 -64
- package/src/installs/openssh.md +1056 -0
- package/src/installs/pandoc.js +644 -26
- package/src/installs/pandoc.md +1036 -0
- package/src/installs/pinentry.js +492 -26
- package/src/installs/pinentry.md +1142 -0
- package/src/installs/pngyu.js +851 -26
- package/src/installs/pngyu.md +896 -0
- package/src/installs/postman.js +781 -26
- package/src/installs/postman.md +940 -0
- package/src/installs/procps.js +425 -0
- package/src/installs/procps.md +851 -0
- package/src/installs/safari-tech-preview.js +355 -25
- package/src/installs/safari-tech-preview.md +533 -0
- package/src/installs/sfnt2woff.js +640 -26
- package/src/installs/sfnt2woff.md +795 -0
- package/src/installs/shellcheck.js +463 -26
- package/src/installs/shellcheck.md +1005 -0
- package/src/installs/slack.js +722 -25
- package/src/installs/slack.md +865 -0
- package/src/installs/snagit.js +566 -25
- package/src/installs/snagit.md +844 -0
- package/src/installs/software-properties-common.js +372 -0
- package/src/installs/software-properties-common.md +805 -0
- package/src/installs/spotify.js +858 -25
- package/src/installs/spotify.md +901 -0
- package/src/installs/studio-3t.js +803 -26
- package/src/installs/studio-3t.md +918 -0
- package/src/installs/sublime-text.js +780 -25
- package/src/installs/sublime-text.md +914 -0
- package/src/installs/superwhisper.js +687 -25
- package/src/installs/superwhisper.md +630 -0
- package/src/installs/tailscale.js +727 -26
- package/src/installs/tailscale.md +1100 -0
- package/src/installs/tar.js +389 -0
- package/src/installs/tar.md +946 -0
- package/src/installs/termius.js +780 -26
- package/src/installs/termius.md +844 -0
- package/src/installs/terraform.js +761 -26
- package/src/installs/terraform.md +899 -0
- package/src/installs/tidal.js +752 -25
- package/src/installs/tidal.md +864 -0
- package/src/installs/tmux.js +328 -26
- package/src/installs/tmux.md +1030 -0
- package/src/installs/tree.js +393 -26
- package/src/installs/tree.md +833 -0
- package/src/installs/unzip.js +460 -0
- package/src/installs/unzip.md +879 -0
- package/src/installs/vim.js +403 -26
- package/src/installs/vim.md +1040 -0
- package/src/installs/vlc.js +803 -26
- package/src/installs/vlc.md +927 -0
- package/src/installs/vscode.js +825 -26
- package/src/installs/vscode.md +1002 -0
- package/src/installs/wget.js +415 -0
- package/src/installs/wget.md +791 -0
- package/src/installs/whatsapp.js +710 -25
- package/src/installs/whatsapp.md +854 -0
- package/src/installs/winpty.js +352 -0
- package/src/installs/winpty.md +620 -0
- package/src/installs/woff2.js +535 -26
- package/src/installs/woff2.md +977 -0
- package/src/installs/wsl.js +572 -0
- package/src/installs/wsl.md +699 -0
- package/src/installs/xcode-clt.js +520 -0
- package/src/installs/xcode-clt.md +351 -0
- package/src/installs/xcode.js +542 -26
- package/src/installs/xcode.md +573 -0
- package/src/installs/yarn.js +806 -26
- package/src/installs/yarn.md +1074 -0
- package/src/installs/yq.js +636 -26
- package/src/installs/yq.md +944 -0
- package/src/installs/yt-dlp.js +683 -26
- package/src/installs/yt-dlp.md +946 -0
- package/src/installs/yum-utils.js +297 -0
- package/src/installs/yum-utils.md +648 -0
- package/src/installs/zoom.js +740 -25
- package/src/installs/zoom.md +884 -0
- package/src/scripts/README.md +567 -45
- package/src/scripts/STATUS.md +208 -0
- package/src/scripts/afk.js +395 -7
- package/src/scripts/backup-all.js +731 -9
- package/src/scripts/backup-source.js +711 -8
- package/src/scripts/brewd.js +373 -7
- package/src/scripts/brewi.js +505 -9
- package/src/scripts/brewr.js +512 -9
- package/src/scripts/brews.js +462 -9
- package/src/scripts/brewu.js +488 -7
- package/src/scripts/c.js +185 -7
- package/src/scripts/ccurl.js +325 -8
- package/src/scripts/certbot-crontab-init.js +488 -8
- package/src/scripts/certbot-init.js +641 -9
- package/src/scripts/ch.js +339 -7
- package/src/scripts/claude-danger.js +253 -8
- package/src/scripts/clean-dev.js +419 -8
- package/src/scripts/clear-dns-cache.js +525 -7
- package/src/scripts/clone.js +417 -7
- package/src/scripts/code-all.js +420 -7
- package/src/scripts/count-files.js +195 -8
- package/src/scripts/count-folders.js +195 -8
- package/src/scripts/count.js +248 -8
- package/src/scripts/d.js +203 -7
- package/src/scripts/datauri.js +373 -8
- package/src/scripts/delete-files.js +363 -7
- package/src/scripts/docker-clean.js +410 -8
- package/src/scripts/dp.js +426 -7
- package/src/scripts/e.js +375 -9
- package/src/scripts/empty-trash.js +497 -7
- package/src/scripts/evm.js +428 -9
- package/src/scripts/fetch-github-repos.js +441 -10
- package/src/scripts/get-channel.js +329 -8
- package/src/scripts/get-course.js +384 -11
- package/src/scripts/get-dependencies.js +290 -9
- package/src/scripts/get-folder.js +783 -10
- package/src/scripts/get-tunes.js +411 -10
- package/src/scripts/get-video.js +352 -9
- package/src/scripts/git-backup.js +561 -9
- package/src/scripts/git-clone.js +477 -9
- package/src/scripts/git-pup.js +303 -7
- package/src/scripts/git-push.js +380 -8
- package/src/scripts/h.js +607 -9
- package/src/scripts/hide-desktop-icons.js +483 -7
- package/src/scripts/hide-hidden-files.js +522 -7
- package/src/scripts/install-dependencies-from.js +440 -9
- package/src/scripts/ips.js +647 -10
- package/src/scripts/iso.js +354 -8
- package/src/scripts/killni.js +561 -7
- package/src/scripts/ll.js +451 -8
- package/src/scripts/local-ip.js +310 -8
- package/src/scripts/m.js +508 -8
- package/src/scripts/map.js +293 -8
- package/src/scripts/mkd.js +287 -7
- package/src/scripts/ncu-update-all.js +441 -8
- package/src/scripts/nginx-init.js +702 -12
- package/src/scripts/npmi.js +366 -7
- package/src/scripts/o.js +495 -8
- package/src/scripts/org-by-date.js +321 -7
- package/src/scripts/p.js +208 -7
- package/src/scripts/packages.js +313 -8
- package/src/scripts/path.js +209 -7
- package/src/scripts/ports.js +582 -8
- package/src/scripts/q.js +290 -8
- package/src/scripts/refresh-files.js +378 -10
- package/src/scripts/remove-smaller-files.js +500 -8
- package/src/scripts/rename-files-with-date.js +517 -9
- package/src/scripts/resize-image.js +523 -9
- package/src/scripts/rm-safe.js +653 -8
- package/src/scripts/s.js +525 -9
- package/src/scripts/set-git-public.js +349 -7
- package/src/scripts/show-desktop-icons.js +459 -7
- package/src/scripts/show-hidden-files.js +456 -7
- package/src/scripts/tpa.js +265 -8
- package/src/scripts/tpo.js +264 -7
- package/src/scripts/u.js +489 -7
- package/src/scripts/vpush.js +422 -8
- package/src/scripts/y.js +267 -7
- package/src/utils/common/os.js +94 -2
- package/src/utils/ubuntu/apt.js +13 -7
- package/src/utils/windows/choco.js +82 -26
- package/src/utils/windows/winget.js +89 -27
|
@@ -1,26 +1,399 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* get-course - Download a Pluralsight course using yt-dlp
|
|
5
|
+
*
|
|
6
|
+
* Migrated from legacy dotfiles alias.
|
|
7
|
+
* Original:
|
|
8
|
+
* get-course(){
|
|
9
|
+
* local usage="get-course %COURSE_NAME_FROM_URL% %USERNAME% %PASSWORD%";
|
|
10
|
+
* local course="$1";
|
|
11
|
+
* local username="$2";
|
|
12
|
+
* local password="$3";
|
|
13
|
+
* local prefix="";
|
|
14
|
+
* if [ -e "/usr/local/bin/yt-dlp" ]; then
|
|
15
|
+
* prefix="/usr/local/bin/";
|
|
16
|
+
* fi
|
|
17
|
+
* if [ -z "$course" ]; then
|
|
18
|
+
* echo "Problem getting Pluralisight course: Course name not supplied"
|
|
19
|
+
* echo "$usage"
|
|
20
|
+
* elif [ -z "$username" ]; then
|
|
21
|
+
* echo "Problem getting Pluralisight course: Username not supplied"
|
|
22
|
+
* echo "$usage"
|
|
23
|
+
* elif [ -z "$password" ]; then
|
|
24
|
+
* echo "Problem getting Pluralisight course: Password not supplied"
|
|
25
|
+
* echo "$usage"
|
|
26
|
+
* else
|
|
27
|
+
* eval "${prefix}yt-dlp --verbose --username $username --password $password --rate-limit 50K --sleep-interval 600 -o \"%(autonumber)s - %(title)s.%(ext)s\" \"https://app.pluralsight.com/library/courses/${course}\""
|
|
28
|
+
* fi
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* This script downloads a course from Pluralsight using yt-dlp with:
|
|
32
|
+
* - Authentication via username/password
|
|
33
|
+
* - Rate limiting (50KB/s) to avoid detection
|
|
34
|
+
* - Sleep intervals (600 seconds) between downloads
|
|
35
|
+
* - Verbose output for debugging
|
|
36
|
+
* - Numbered filenames with course titles
|
|
37
|
+
*
|
|
5
38
|
* @module scripts/get-course
|
|
6
39
|
*/
|
|
7
40
|
|
|
41
|
+
const os = require('../utils/common/os');
|
|
42
|
+
const shell = require('../utils/common/shell');
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Usage string displayed when required arguments are missing.
|
|
46
|
+
* Shows the expected format for invoking the command.
|
|
47
|
+
*/
|
|
48
|
+
const USAGE = 'get-course <course-name-from-url> <username> <password>';
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Checks if yt-dlp is installed on the system.
|
|
52
|
+
* Uses the shell utility's pure Node.js implementation to locate the executable.
|
|
53
|
+
*
|
|
54
|
+
* @returns {boolean} True if yt-dlp is found in PATH, false otherwise
|
|
55
|
+
*/
|
|
56
|
+
function isYtDlpInstalled() {
|
|
57
|
+
return shell.commandExists('yt-dlp');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Displays an error message with installation instructions for yt-dlp.
|
|
62
|
+
* Instructions vary by platform to show the appropriate package manager.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} platformType - The detected platform type (macos, ubuntu, etc.)
|
|
65
|
+
*/
|
|
66
|
+
function showYtDlpInstallInstructions(platformType) {
|
|
67
|
+
console.error('Error: yt-dlp is required but not installed.');
|
|
68
|
+
console.error('');
|
|
69
|
+
|
|
70
|
+
// Show platform-specific installation instructions
|
|
71
|
+
switch (platformType) {
|
|
72
|
+
case 'macos':
|
|
73
|
+
console.error('Install it with:');
|
|
74
|
+
console.error(' brew install yt-dlp');
|
|
75
|
+
break;
|
|
76
|
+
case 'ubuntu':
|
|
77
|
+
case 'debian':
|
|
78
|
+
case 'raspbian':
|
|
79
|
+
console.error('Install it with:');
|
|
80
|
+
console.error(' sudo apt install yt-dlp');
|
|
81
|
+
console.error('');
|
|
82
|
+
console.error('Or install via pip for the latest version:');
|
|
83
|
+
console.error(' pip install yt-dlp');
|
|
84
|
+
break;
|
|
85
|
+
case 'amazon_linux':
|
|
86
|
+
case 'rhel':
|
|
87
|
+
case 'fedora':
|
|
88
|
+
console.error('Install it with:');
|
|
89
|
+
console.error(' pip install yt-dlp');
|
|
90
|
+
console.error('');
|
|
91
|
+
console.error('Or on Fedora:');
|
|
92
|
+
console.error(' sudo dnf install yt-dlp');
|
|
93
|
+
break;
|
|
94
|
+
case 'windows':
|
|
95
|
+
case 'cmd':
|
|
96
|
+
case 'powershell':
|
|
97
|
+
console.error('Install it with:');
|
|
98
|
+
console.error(' winget install yt-dlp');
|
|
99
|
+
console.error('');
|
|
100
|
+
console.error('Or with Chocolatey:');
|
|
101
|
+
console.error(' choco install yt-dlp');
|
|
102
|
+
break;
|
|
103
|
+
case 'gitbash':
|
|
104
|
+
console.error('Install it with:');
|
|
105
|
+
console.error(' Download from: https://github.com/yt-dlp/yt-dlp/releases');
|
|
106
|
+
console.error(' Or use: pip install yt-dlp');
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
109
|
+
console.error('Install it from: https://github.com/yt-dlp/yt-dlp');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Validates the command line arguments.
|
|
115
|
+
* Checks that course name, username, and password are all provided.
|
|
116
|
+
*
|
|
117
|
+
* @param {string[]} args - Command line arguments [course, username, password]
|
|
118
|
+
* @returns {{ valid: boolean, course?: string, username?: string, password?: string, error?: string }}
|
|
119
|
+
*/
|
|
120
|
+
function validateArgs(args) {
|
|
121
|
+
const [course, username, password] = args;
|
|
122
|
+
|
|
123
|
+
if (!course || course.trim() === '') {
|
|
124
|
+
return {
|
|
125
|
+
valid: false,
|
|
126
|
+
error: 'Problem getting Pluralsight course: Course name not supplied'
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (!username || username.trim() === '') {
|
|
131
|
+
return {
|
|
132
|
+
valid: false,
|
|
133
|
+
error: 'Problem getting Pluralsight course: Username not supplied'
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (!password || password.trim() === '') {
|
|
138
|
+
return {
|
|
139
|
+
valid: false,
|
|
140
|
+
error: 'Problem getting Pluralsight course: Password not supplied'
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
valid: true,
|
|
146
|
+
course: course.trim(),
|
|
147
|
+
username: username.trim(),
|
|
148
|
+
password: password.trim()
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Pure Node.js implementation for downloading Pluralsight courses.
|
|
154
|
+
*
|
|
155
|
+
* This function uses yt-dlp which is a cross-platform tool, so the same
|
|
156
|
+
* command works on all operating systems. The implementation validates
|
|
157
|
+
* arguments, checks for yt-dlp, and then spawns the download process.
|
|
158
|
+
*
|
|
159
|
+
* Since yt-dlp provides the actual download functionality and works
|
|
160
|
+
* identically across platforms, all platform-specific functions delegate
|
|
161
|
+
* to this implementation.
|
|
162
|
+
*
|
|
163
|
+
* @param {string[]} args - Command line arguments [course, username, password]
|
|
164
|
+
* @param {string} platformType - The detected platform type (for error messages)
|
|
165
|
+
* @returns {Promise<void>}
|
|
166
|
+
*/
|
|
167
|
+
async function do_get_course_nodejs(args, platformType = 'unknown') {
|
|
168
|
+
// Step 1: Validate arguments
|
|
169
|
+
const validation = validateArgs(args);
|
|
170
|
+
if (!validation.valid) {
|
|
171
|
+
console.error(validation.error);
|
|
172
|
+
console.error(USAGE);
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Step 2: Check if yt-dlp is installed
|
|
177
|
+
if (!isYtDlpInstalled()) {
|
|
178
|
+
showYtDlpInstallInstructions(platformType);
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Step 3: Build the Pluralsight URL
|
|
183
|
+
const { course, username, password } = validation;
|
|
184
|
+
const courseUrl = `https://app.pluralsight.com/library/courses/${course}`;
|
|
185
|
+
|
|
186
|
+
// Step 4: Build yt-dlp arguments
|
|
187
|
+
// Using the same parameters as the original bash function:
|
|
188
|
+
// --verbose: Show detailed output for debugging
|
|
189
|
+
// --username/--password: Pluralsight authentication
|
|
190
|
+
// --rate-limit 50K: Limit download speed to 50KB/s to avoid detection
|
|
191
|
+
// --sleep-interval 600: Wait 600 seconds (10 minutes) between each video
|
|
192
|
+
// -o: Output template with auto-numbering and title
|
|
193
|
+
const ytdlpArgs = [
|
|
194
|
+
'--verbose',
|
|
195
|
+
'--username', username,
|
|
196
|
+
'--password', password,
|
|
197
|
+
'--rate-limit', '50K',
|
|
198
|
+
'--sleep-interval', '600',
|
|
199
|
+
'-o', '%(autonumber)s - %(title)s.%(ext)s',
|
|
200
|
+
courseUrl
|
|
201
|
+
];
|
|
202
|
+
|
|
203
|
+
console.log(`Downloading Pluralsight course: ${course}`);
|
|
204
|
+
console.log('');
|
|
205
|
+
console.log('Note: This process uses rate limiting and sleep intervals to avoid detection.');
|
|
206
|
+
console.log(' Videos will be downloaded slowly with 10-minute pauses between each.');
|
|
207
|
+
console.log('');
|
|
208
|
+
|
|
209
|
+
// Step 5: Execute yt-dlp with streaming output
|
|
210
|
+
// We use spawnAsync to show real-time progress from yt-dlp
|
|
211
|
+
const result = await shell.spawnAsync('yt-dlp', ytdlpArgs, {
|
|
212
|
+
onStdout: (data) => process.stdout.write(data),
|
|
213
|
+
onStderr: (data) => process.stderr.write(data)
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
if (result.code !== 0) {
|
|
217
|
+
console.error('');
|
|
218
|
+
console.error('Error: yt-dlp exited with code', result.code);
|
|
219
|
+
console.error('');
|
|
220
|
+
console.error('Common issues:');
|
|
221
|
+
console.error(' - Invalid username or password');
|
|
222
|
+
console.error(' - Course name is incorrect (check the URL)');
|
|
223
|
+
console.error(' - Your Pluralsight subscription may not include this course');
|
|
224
|
+
console.error(' - yt-dlp may need to be updated: pip install -U yt-dlp');
|
|
225
|
+
process.exit(result.code);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
console.log('');
|
|
229
|
+
console.log('Download complete!');
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Downloads a Pluralsight course on macOS.
|
|
234
|
+
*
|
|
235
|
+
* Uses the shared Node.js implementation since yt-dlp works identically
|
|
236
|
+
* across all platforms. The only macOS-specific aspect is the installation
|
|
237
|
+
* instructions shown if yt-dlp is missing (recommends Homebrew).
|
|
238
|
+
*
|
|
239
|
+
* @param {string[]} args - Command line arguments [course, username, password]
|
|
240
|
+
* @returns {Promise<void>}
|
|
241
|
+
*/
|
|
242
|
+
async function do_get_course_macos(args) {
|
|
243
|
+
return do_get_course_nodejs(args, 'macos');
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Downloads a Pluralsight course on Ubuntu.
|
|
248
|
+
*
|
|
249
|
+
* Uses the shared Node.js implementation since yt-dlp works identically
|
|
250
|
+
* across all platforms. The only Ubuntu-specific aspect is the installation
|
|
251
|
+
* instructions shown if yt-dlp is missing (recommends apt or pip).
|
|
252
|
+
*
|
|
253
|
+
* @param {string[]} args - Command line arguments [course, username, password]
|
|
254
|
+
* @returns {Promise<void>}
|
|
255
|
+
*/
|
|
256
|
+
async function do_get_course_ubuntu(args) {
|
|
257
|
+
return do_get_course_nodejs(args, 'ubuntu');
|
|
258
|
+
}
|
|
259
|
+
|
|
8
260
|
/**
|
|
9
|
-
* Downloads a course
|
|
10
|
-
* rate limiting and sleep intervals to avoid detection.
|
|
261
|
+
* Downloads a Pluralsight course on Raspberry Pi OS.
|
|
11
262
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
263
|
+
* Uses the shared Node.js implementation since yt-dlp works identically
|
|
264
|
+
* across all platforms. On Raspberry Pi, downloads may be slower due to
|
|
265
|
+
* hardware limitations, but the rate limiting is already conservative.
|
|
266
|
+
*
|
|
267
|
+
* @param {string[]} args - Command line arguments [course, username, password]
|
|
16
268
|
* @returns {Promise<void>}
|
|
17
269
|
*/
|
|
18
|
-
async function
|
|
19
|
-
|
|
270
|
+
async function do_get_course_raspbian(args) {
|
|
271
|
+
return do_get_course_nodejs(args, 'raspbian');
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Downloads a Pluralsight course on Amazon Linux.
|
|
276
|
+
*
|
|
277
|
+
* Uses the shared Node.js implementation since yt-dlp works identically
|
|
278
|
+
* across all platforms. On Amazon Linux, yt-dlp is typically installed via pip.
|
|
279
|
+
*
|
|
280
|
+
* @param {string[]} args - Command line arguments [course, username, password]
|
|
281
|
+
* @returns {Promise<void>}
|
|
282
|
+
*/
|
|
283
|
+
async function do_get_course_amazon_linux(args) {
|
|
284
|
+
return do_get_course_nodejs(args, 'amazon_linux');
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Downloads a Pluralsight course on Windows Command Prompt.
|
|
289
|
+
*
|
|
290
|
+
* Uses the shared Node.js implementation since yt-dlp works identically
|
|
291
|
+
* across all platforms. On Windows, yt-dlp can be installed via winget
|
|
292
|
+
* or Chocolatey.
|
|
293
|
+
*
|
|
294
|
+
* @param {string[]} args - Command line arguments [course, username, password]
|
|
295
|
+
* @returns {Promise<void>}
|
|
296
|
+
*/
|
|
297
|
+
async function do_get_course_cmd(args) {
|
|
298
|
+
return do_get_course_nodejs(args, 'cmd');
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Downloads a Pluralsight course on Windows PowerShell.
|
|
303
|
+
*
|
|
304
|
+
* Uses the shared Node.js implementation since yt-dlp works identically
|
|
305
|
+
* across all platforms. The behavior is the same as CMD.
|
|
306
|
+
*
|
|
307
|
+
* @param {string[]} args - Command line arguments [course, username, password]
|
|
308
|
+
* @returns {Promise<void>}
|
|
309
|
+
*/
|
|
310
|
+
async function do_get_course_powershell(args) {
|
|
311
|
+
return do_get_course_nodejs(args, 'powershell');
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Downloads a Pluralsight course in Git Bash on Windows.
|
|
316
|
+
*
|
|
317
|
+
* Uses the shared Node.js implementation since yt-dlp works identically
|
|
318
|
+
* across all platforms. Git Bash provides a Unix-like environment on Windows.
|
|
319
|
+
*
|
|
320
|
+
* @param {string[]} args - Command line arguments [course, username, password]
|
|
321
|
+
* @returns {Promise<void>}
|
|
322
|
+
*/
|
|
323
|
+
async function do_get_course_gitbash(args) {
|
|
324
|
+
return do_get_course_nodejs(args, 'gitbash');
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Main entry point - detects environment and executes appropriate implementation.
|
|
329
|
+
*
|
|
330
|
+
* Downloads a course from Pluralsight using yt-dlp with authentication,
|
|
331
|
+
* rate limiting, and sleep intervals to avoid detection. The course name
|
|
332
|
+
* should be extracted from the Pluralsight course URL.
|
|
333
|
+
*
|
|
334
|
+
* Example:
|
|
335
|
+
* For URL: https://app.pluralsight.com/library/courses/javascript-fundamentals
|
|
336
|
+
* Use course name: javascript-fundamentals
|
|
337
|
+
*
|
|
338
|
+
* Usage:
|
|
339
|
+
* get-course <course-name-from-url> <username> <password>
|
|
340
|
+
*
|
|
341
|
+
* Downloaded files are saved to the current directory with format:
|
|
342
|
+
* 01 - Introduction.mp4
|
|
343
|
+
* 02 - Getting Started.mp4
|
|
344
|
+
* etc.
|
|
345
|
+
*
|
|
346
|
+
* @param {string[]} args - Command line arguments [course, username, password]
|
|
347
|
+
* @returns {Promise<void>}
|
|
348
|
+
*/
|
|
349
|
+
async function do_get_course(args) {
|
|
350
|
+
const platform = os.detect();
|
|
351
|
+
|
|
352
|
+
const handlers = {
|
|
353
|
+
'macos': do_get_course_macos,
|
|
354
|
+
'ubuntu': do_get_course_ubuntu,
|
|
355
|
+
'debian': do_get_course_ubuntu,
|
|
356
|
+
'raspbian': do_get_course_raspbian,
|
|
357
|
+
'amazon_linux': do_get_course_amazon_linux,
|
|
358
|
+
'rhel': do_get_course_amazon_linux,
|
|
359
|
+
'fedora': do_get_course_ubuntu,
|
|
360
|
+
'linux': do_get_course_ubuntu,
|
|
361
|
+
'wsl': do_get_course_ubuntu,
|
|
362
|
+
'cmd': do_get_course_cmd,
|
|
363
|
+
'windows': do_get_course_cmd,
|
|
364
|
+
'powershell': do_get_course_powershell,
|
|
365
|
+
'gitbash': do_get_course_gitbash
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
const handler = handlers[platform.type];
|
|
369
|
+
if (!handler) {
|
|
370
|
+
console.error(`Platform '${platform.type}' is not supported for this command.`);
|
|
371
|
+
console.error('');
|
|
372
|
+
console.error('Supported platforms:');
|
|
373
|
+
console.error(' - macOS');
|
|
374
|
+
console.error(' - Ubuntu, Debian, and other Linux distributions');
|
|
375
|
+
console.error(' - Raspberry Pi OS');
|
|
376
|
+
console.error(' - Amazon Linux, RHEL, Fedora');
|
|
377
|
+
console.error(' - Windows (CMD, PowerShell, Git Bash)');
|
|
378
|
+
process.exit(1);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
await handler(args);
|
|
20
382
|
}
|
|
21
383
|
|
|
22
|
-
module.exports = {
|
|
384
|
+
module.exports = {
|
|
385
|
+
main: do_get_course,
|
|
386
|
+
do_get_course,
|
|
387
|
+
do_get_course_nodejs,
|
|
388
|
+
do_get_course_macos,
|
|
389
|
+
do_get_course_ubuntu,
|
|
390
|
+
do_get_course_raspbian,
|
|
391
|
+
do_get_course_amazon_linux,
|
|
392
|
+
do_get_course_cmd,
|
|
393
|
+
do_get_course_powershell,
|
|
394
|
+
do_get_course_gitbash
|
|
395
|
+
};
|
|
23
396
|
|
|
24
397
|
if (require.main === module) {
|
|
25
|
-
|
|
398
|
+
do_get_course(process.argv.slice(2));
|
|
26
399
|
}
|