@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
package/src/scripts/get-video.js
CHANGED
|
@@ -1,24 +1,367 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* get-video - Download video from a URL using yt-dlp
|
|
5
|
+
*
|
|
6
|
+
* Migrated from legacy dotfiles alias.
|
|
7
|
+
* Original:
|
|
8
|
+
* get-video(){
|
|
9
|
+
* local usage="get-tunes %VIDEO_URL%";
|
|
10
|
+
* local url="$1";
|
|
11
|
+
* if [ -f "/usr/local/bin/yt-dlp" ]; then
|
|
12
|
+
* prefix="/usr/local/bin/";
|
|
13
|
+
* fi
|
|
14
|
+
* if [ -z "${url}" ]; then
|
|
15
|
+
* echo "Problem fetching video: URL not supplied";
|
|
16
|
+
* echo "$usage";
|
|
17
|
+
* else
|
|
18
|
+
* echo "Excluding audio...";
|
|
19
|
+
* eval "${prefix}yt-dlp --buffer-size 16K --keep-video --prefer-insecure --format mp4 --ignore-errors --output '%(title)s.%(ext)s' $1";
|
|
20
|
+
* fi
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* This script downloads video (without audio) from a URL using yt-dlp.
|
|
24
|
+
* It outputs in MP4 format, excluding any audio streams.
|
|
25
|
+
*
|
|
26
|
+
* Usage:
|
|
27
|
+
* get-video <url> # Download video only as MP4 (no audio)
|
|
28
|
+
*
|
|
29
|
+
* Examples:
|
|
30
|
+
* get-video https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
31
|
+
* get-video https://vimeo.com/123456789
|
|
32
|
+
*
|
|
5
33
|
* @module scripts/get-video
|
|
6
34
|
*/
|
|
7
35
|
|
|
36
|
+
const os = require('../utils/common/os');
|
|
37
|
+
const { execSync, spawnSync } = require('child_process');
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Display usage information for this command.
|
|
41
|
+
* Shows valid command syntax and examples.
|
|
42
|
+
*/
|
|
43
|
+
function showUsage() {
|
|
44
|
+
console.log('');
|
|
45
|
+
console.log('Usage: get-video <url>');
|
|
46
|
+
console.log('');
|
|
47
|
+
console.log('Arguments:');
|
|
48
|
+
console.log(' url The URL of the video to download');
|
|
49
|
+
console.log('');
|
|
50
|
+
console.log('Description:');
|
|
51
|
+
console.log(' Downloads video only (no audio) from a URL using yt-dlp.');
|
|
52
|
+
console.log(' The output format is MP4.');
|
|
53
|
+
console.log('');
|
|
54
|
+
console.log('Examples:');
|
|
55
|
+
console.log(' get-video https://www.youtube.com/watch?v=VIDEO_ID');
|
|
56
|
+
console.log(' get-video https://vimeo.com/123456789');
|
|
57
|
+
console.log('');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Helper function to check if a command exists on the system.
|
|
62
|
+
* Used to verify that yt-dlp is installed before attempting to use it.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} cmd - The command name to check
|
|
65
|
+
* @returns {boolean} True if the command exists, false otherwise
|
|
66
|
+
*/
|
|
67
|
+
function isCommandAvailable(cmd) {
|
|
68
|
+
try {
|
|
69
|
+
// Use 'which' on Unix-like systems, 'where' on Windows
|
|
70
|
+
const checkCmd = process.platform === 'win32' ? `where ${cmd}` : `which ${cmd}`;
|
|
71
|
+
execSync(checkCmd, { stdio: 'ignore' });
|
|
72
|
+
return true;
|
|
73
|
+
} catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Validate that the provided string looks like a URL.
|
|
80
|
+
* This is a basic check to catch obvious mistakes, not a comprehensive URL validator.
|
|
81
|
+
*
|
|
82
|
+
* @param {string} url - The string to validate
|
|
83
|
+
* @returns {boolean} True if the string appears to be a URL
|
|
84
|
+
*/
|
|
85
|
+
function isValidUrl(url) {
|
|
86
|
+
// Basic URL pattern check - must start with http:// or https://
|
|
87
|
+
// This catches common mistakes like forgetting the protocol
|
|
88
|
+
return /^https?:\/\/.+/.test(url);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Pure Node.js implementation that downloads video using yt-dlp.
|
|
93
|
+
*
|
|
94
|
+
* This function contains the core download logic that works identically
|
|
95
|
+
* across all platforms. yt-dlp is a native command-line tool that is
|
|
96
|
+
* superior for video downloads - it handles:
|
|
97
|
+
* - Video extraction and format selection
|
|
98
|
+
* - Playlist handling
|
|
99
|
+
* - Format negotiation with video sites
|
|
100
|
+
* - Error recovery
|
|
101
|
+
*
|
|
102
|
+
* We use yt-dlp rather than reimplementing this in Node.js because:
|
|
103
|
+
* 1. yt-dlp is battle-tested and actively maintained
|
|
104
|
+
* 2. It handles complex format negotiation with video sites
|
|
105
|
+
* 3. It supports hundreds of video sites out of the box
|
|
106
|
+
* 4. Reimplementing this in Node.js would be extremely complex
|
|
107
|
+
*
|
|
108
|
+
* @param {string[]} args - Command line arguments: [url]
|
|
109
|
+
* @returns {Promise<void>}
|
|
110
|
+
*/
|
|
111
|
+
async function do_get_video_nodejs(args) {
|
|
112
|
+
const url = args[0];
|
|
113
|
+
|
|
114
|
+
// Check if yt-dlp is installed
|
|
115
|
+
if (!isCommandAvailable('yt-dlp')) {
|
|
116
|
+
console.error('Error: yt-dlp is required but not installed.');
|
|
117
|
+
console.error('');
|
|
118
|
+
console.error('Install yt-dlp using one of these methods:');
|
|
119
|
+
console.error('');
|
|
120
|
+
console.error(' macOS:');
|
|
121
|
+
console.error(' brew install yt-dlp');
|
|
122
|
+
console.error('');
|
|
123
|
+
console.error(' Ubuntu/Debian:');
|
|
124
|
+
console.error(' sudo apt install yt-dlp');
|
|
125
|
+
console.error(' # or via pip: pip install yt-dlp');
|
|
126
|
+
console.error('');
|
|
127
|
+
console.error(' Windows:');
|
|
128
|
+
console.error(' winget install yt-dlp');
|
|
129
|
+
console.error(' # or: choco install yt-dlp');
|
|
130
|
+
console.error('');
|
|
131
|
+
console.error(' All platforms (via pip):');
|
|
132
|
+
console.error(' pip install yt-dlp');
|
|
133
|
+
console.error('');
|
|
134
|
+
console.error('For more information: https://github.com/yt-dlp/yt-dlp');
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Validate that a URL was provided
|
|
139
|
+
if (!url) {
|
|
140
|
+
console.error('Error: Video URL not supplied.');
|
|
141
|
+
showUsage();
|
|
142
|
+
process.exit(1);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Validate that the URL looks valid
|
|
146
|
+
if (!isValidUrl(url)) {
|
|
147
|
+
console.error(`Error: Invalid URL format: ${url}`);
|
|
148
|
+
console.error('URL must start with http:// or https://');
|
|
149
|
+
showUsage();
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Build the yt-dlp command for video-only download
|
|
154
|
+
// The output template uses the video title for the filename
|
|
155
|
+
const outputTemplate = '%(title)s.%(ext)s';
|
|
156
|
+
|
|
157
|
+
// Video-only mode options:
|
|
158
|
+
// --buffer-size 16K : Set download buffer size (helps with slow connections)
|
|
159
|
+
// --keep-video : Keep the video file (ensures video is saved)
|
|
160
|
+
// --prefer-insecure : Use HTTP instead of HTTPS when available (sometimes faster)
|
|
161
|
+
// --format mp4 : Select MP4 format for video
|
|
162
|
+
// --ignore-errors : Continue on download errors (useful for playlists)
|
|
163
|
+
// --output : Set the output filename template
|
|
164
|
+
|
|
165
|
+
const ytdlpArgs = [
|
|
166
|
+
'--buffer-size', '16K',
|
|
167
|
+
'--keep-video',
|
|
168
|
+
'--prefer-insecure',
|
|
169
|
+
'--format', 'mp4',
|
|
170
|
+
'--ignore-errors',
|
|
171
|
+
'--output', outputTemplate,
|
|
172
|
+
url
|
|
173
|
+
];
|
|
174
|
+
|
|
175
|
+
// Display what we're doing
|
|
176
|
+
console.log('Excluding audio (video only)...');
|
|
177
|
+
console.log(`URL: ${url}`);
|
|
178
|
+
console.log('');
|
|
179
|
+
|
|
180
|
+
// Execute yt-dlp with the constructed arguments
|
|
181
|
+
// Using spawnSync to properly handle argument quoting and real-time output
|
|
182
|
+
const result = spawnSync('yt-dlp', ytdlpArgs, {
|
|
183
|
+
stdio: 'inherit', // Pass through stdin/stdout/stderr for real-time output
|
|
184
|
+
shell: false // Don't use shell to avoid quoting issues
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
// Check if yt-dlp execution succeeded
|
|
188
|
+
if (result.error) {
|
|
189
|
+
console.error('Error executing yt-dlp:', result.error.message);
|
|
190
|
+
process.exit(1);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Exit with yt-dlp's exit code
|
|
194
|
+
if (result.status !== 0) {
|
|
195
|
+
process.exit(result.status);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Download video on macOS using yt-dlp.
|
|
201
|
+
*
|
|
202
|
+
* macOS can use the exact same logic as other platforms since yt-dlp
|
|
203
|
+
* is a cross-platform tool. The command syntax is identical.
|
|
204
|
+
*
|
|
205
|
+
* @param {string[]} args - Command line arguments: [url]
|
|
206
|
+
* @returns {Promise<void>}
|
|
207
|
+
*/
|
|
208
|
+
async function do_get_video_macos(args) {
|
|
209
|
+
// yt-dlp works identically on macOS - delegate to the Node.js implementation
|
|
210
|
+
return do_get_video_nodejs(args);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Download video on Ubuntu using yt-dlp.
|
|
215
|
+
*
|
|
216
|
+
* Ubuntu can use the exact same logic as other platforms since yt-dlp
|
|
217
|
+
* is a cross-platform tool. The command syntax is identical.
|
|
218
|
+
*
|
|
219
|
+
* @param {string[]} args - Command line arguments: [url]
|
|
220
|
+
* @returns {Promise<void>}
|
|
221
|
+
*/
|
|
222
|
+
async function do_get_video_ubuntu(args) {
|
|
223
|
+
// yt-dlp works identically on Ubuntu - delegate to the Node.js implementation
|
|
224
|
+
return do_get_video_nodejs(args);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Download video on Raspberry Pi OS using yt-dlp.
|
|
229
|
+
*
|
|
230
|
+
* Raspberry Pi OS can use the exact same logic as other platforms since yt-dlp
|
|
231
|
+
* is a cross-platform tool. The command syntax is identical.
|
|
232
|
+
*
|
|
233
|
+
* @param {string[]} args - Command line arguments: [url]
|
|
234
|
+
* @returns {Promise<void>}
|
|
235
|
+
*/
|
|
236
|
+
async function do_get_video_raspbian(args) {
|
|
237
|
+
// yt-dlp works identically on Raspbian - delegate to the Node.js implementation
|
|
238
|
+
return do_get_video_nodejs(args);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Download video on Amazon Linux using yt-dlp.
|
|
243
|
+
*
|
|
244
|
+
* Amazon Linux can use the exact same logic as other platforms since yt-dlp
|
|
245
|
+
* is a cross-platform tool. The command syntax is identical.
|
|
246
|
+
*
|
|
247
|
+
* @param {string[]} args - Command line arguments: [url]
|
|
248
|
+
* @returns {Promise<void>}
|
|
249
|
+
*/
|
|
250
|
+
async function do_get_video_amazon_linux(args) {
|
|
251
|
+
// yt-dlp works identically on Amazon Linux - delegate to the Node.js implementation
|
|
252
|
+
return do_get_video_nodejs(args);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Download video on Windows Command Prompt using yt-dlp.
|
|
257
|
+
*
|
|
258
|
+
* Windows CMD can use the exact same logic as other platforms since yt-dlp
|
|
259
|
+
* is a cross-platform tool. The command syntax is identical.
|
|
260
|
+
*
|
|
261
|
+
* @param {string[]} args - Command line arguments: [url]
|
|
262
|
+
* @returns {Promise<void>}
|
|
263
|
+
*/
|
|
264
|
+
async function do_get_video_cmd(args) {
|
|
265
|
+
// yt-dlp works identically on Windows CMD - delegate to the Node.js implementation
|
|
266
|
+
return do_get_video_nodejs(args);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Download video on Windows PowerShell using yt-dlp.
|
|
271
|
+
*
|
|
272
|
+
* Windows PowerShell can use the exact same logic as other platforms since yt-dlp
|
|
273
|
+
* is a cross-platform tool. The command syntax is identical.
|
|
274
|
+
*
|
|
275
|
+
* @param {string[]} args - Command line arguments: [url]
|
|
276
|
+
* @returns {Promise<void>}
|
|
277
|
+
*/
|
|
278
|
+
async function do_get_video_powershell(args) {
|
|
279
|
+
// yt-dlp works identically on PowerShell - delegate to the Node.js implementation
|
|
280
|
+
return do_get_video_nodejs(args);
|
|
281
|
+
}
|
|
282
|
+
|
|
8
283
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
284
|
+
* Download video on Git Bash using yt-dlp.
|
|
285
|
+
*
|
|
286
|
+
* Git Bash can use the exact same logic as other platforms since yt-dlp
|
|
287
|
+
* is a cross-platform tool. The command syntax is identical.
|
|
11
288
|
*
|
|
12
|
-
* @param {string[]} args - Command line arguments
|
|
13
|
-
* @param {string} args.0 - URL to download from
|
|
289
|
+
* @param {string[]} args - Command line arguments: [url]
|
|
14
290
|
* @returns {Promise<void>}
|
|
15
291
|
*/
|
|
16
|
-
async function
|
|
17
|
-
//
|
|
292
|
+
async function do_get_video_gitbash(args) {
|
|
293
|
+
// yt-dlp works identically on Git Bash - delegate to the Node.js implementation
|
|
294
|
+
return do_get_video_nodejs(args);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Main entry point - detects environment and executes appropriate implementation.
|
|
299
|
+
*
|
|
300
|
+
* The "get-video" command downloads video (excluding audio) from a URL using yt-dlp.
|
|
301
|
+
* This is useful when you only need the video file without any audio tracks,
|
|
302
|
+
* such as for:
|
|
303
|
+
* - Creating silent background videos
|
|
304
|
+
* - Video editing where you'll add your own audio
|
|
305
|
+
* - Reducing file size when audio is not needed
|
|
306
|
+
* - Archiving video-only content
|
|
307
|
+
*
|
|
308
|
+
* yt-dlp supports hundreds of video sites including:
|
|
309
|
+
* - YouTube (videos, playlists, channels)
|
|
310
|
+
* - Vimeo
|
|
311
|
+
* - Dailymotion
|
|
312
|
+
* - And many more (see: https://github.com/yt-dlp/yt-dlp/supportedsites.md)
|
|
313
|
+
*
|
|
314
|
+
* @param {string[]} args - Command line arguments: [url]
|
|
315
|
+
* @returns {Promise<void>}
|
|
316
|
+
*/
|
|
317
|
+
async function do_get_video(args) {
|
|
318
|
+
const platform = os.detect();
|
|
319
|
+
|
|
320
|
+
const handlers = {
|
|
321
|
+
'macos': do_get_video_macos,
|
|
322
|
+
'ubuntu': do_get_video_ubuntu,
|
|
323
|
+
'debian': do_get_video_ubuntu,
|
|
324
|
+
'raspbian': do_get_video_raspbian,
|
|
325
|
+
'amazon_linux': do_get_video_amazon_linux,
|
|
326
|
+
'rhel': do_get_video_amazon_linux,
|
|
327
|
+
'fedora': do_get_video_ubuntu,
|
|
328
|
+
'linux': do_get_video_ubuntu,
|
|
329
|
+
'wsl': do_get_video_ubuntu,
|
|
330
|
+
'cmd': do_get_video_cmd,
|
|
331
|
+
'windows': do_get_video_cmd,
|
|
332
|
+
'powershell': do_get_video_powershell,
|
|
333
|
+
'gitbash': do_get_video_gitbash
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const handler = handlers[platform.type];
|
|
337
|
+
if (!handler) {
|
|
338
|
+
console.error(`Platform '${platform.type}' is not supported for this command.`);
|
|
339
|
+
console.error('');
|
|
340
|
+
console.error('Supported platforms:');
|
|
341
|
+
console.error(' - macOS');
|
|
342
|
+
console.error(' - Ubuntu, Debian, and other Linux distributions');
|
|
343
|
+
console.error(' - Raspberry Pi OS');
|
|
344
|
+
console.error(' - Amazon Linux, RHEL, Fedora');
|
|
345
|
+
console.error(' - Windows (CMD, PowerShell, Git Bash)');
|
|
346
|
+
process.exit(1);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
await handler(args);
|
|
18
350
|
}
|
|
19
351
|
|
|
20
|
-
module.exports = {
|
|
352
|
+
module.exports = {
|
|
353
|
+
main: do_get_video,
|
|
354
|
+
do_get_video,
|
|
355
|
+
do_get_video_nodejs,
|
|
356
|
+
do_get_video_macos,
|
|
357
|
+
do_get_video_ubuntu,
|
|
358
|
+
do_get_video_raspbian,
|
|
359
|
+
do_get_video_amazon_linux,
|
|
360
|
+
do_get_video_cmd,
|
|
361
|
+
do_get_video_powershell,
|
|
362
|
+
do_get_video_gitbash
|
|
363
|
+
};
|
|
21
364
|
|
|
22
365
|
if (require.main === module) {
|
|
23
|
-
|
|
366
|
+
do_get_video(process.argv.slice(2));
|
|
24
367
|
}
|