vd-go 1.0.1

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +97 -0
  3. package/index.js +73 -0
  4. package/package.json +17 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License Copyright (c) 2026 Saimon
2
+
3
+ Permission is hereby granted, free of
4
+ charge, to any person obtaining a copy of this software and associated
5
+ documentation files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use, copy, modify, merge,
7
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to the
9
+ following conditions:
10
+
11
+ The above copyright notice and this permission notice
12
+ (including the next paragraph) shall be included in all copies or substantial
13
+ portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
16
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
18
+ EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # vd - High-Performance Video Downloader 🚀
2
+
3
+ `vd` is a lightweight, blazing-fast, and multi-threaded CLI video downloader written in Go. It supports parallel downloads using goroutines, format selection, playlist management, and much more.
4
+
5
+ ## 🌟 Features
6
+
7
+ - **Multi-threaded:** Download multiple URLs or playlist items in parallel using `-go`.
8
+ - **Cross-Platform:** Works seamlessly on Windows, Linux, and macOS.
9
+ - **Format Control:** List and select specific video/audio formats.
10
+ - **Post-processing:** Extract audio, embed subtitles, metadata, and thumbnails (requires FFmpeg).
11
+ - **Privacy & Security:** Support for proxies, cookies (browser/file), and IPv4/IPv6 forcing.
12
+ - **Smart Management:** Skip existing files, record download history, and restrict filenames.
13
+
14
+ ## 📦 Installation
15
+
16
+ Since `vd` is distributed via npm, you can install it globally on any system with Node.js installed:
17
+
18
+ ```bash
19
+ npm install -g vb-go
20
+
21
+ ```
22
+
23
+
24
+ ## 🚀 Quick Start
25
+
26
+ Help menu
27
+ ```bash
28
+ vd -h
29
+
30
+ ```
31
+
32
+ Basic download:
33
+
34
+ ```bash
35
+ vd "[https://www.youtube.com/watch?v=example](https://www.youtube.com/watch?v=example)"
36
+
37
+ ```
38
+
39
+ Download multiple videos in parallel:
40
+
41
+ ```bash
42
+ vd -go "URL1" "URL2" "URL3"
43
+
44
+ ```
45
+
46
+ Download a playlist to a specific directory:
47
+
48
+ ```bash
49
+ vd -P ./my-videos -yes-playlist "PLAYLIST_URL"
50
+
51
+ ```
52
+
53
+ ## 🛠️ Common Options
54
+
55
+ | Flag | Description |
56
+ | ------------- | ------------------------------------------------------- |
57
+ | `-go` | Download all provided URLs in parallel using goroutines |
58
+ | `-go-workers` | Set max parallel workers (e.g., `-go-workers 3`) |
59
+ | `-f` | Specify format (e.g., `bestvideo+bestaudio`) |
60
+ | `-x` | Extract audio only (requires FFmpeg) |
61
+ | `-P` | Set download directory path |
62
+ | `-F` | List all available formats |
63
+ | `-j` | Print JSON information |
64
+
65
+ ## 📖 Examples
66
+
67
+ **Extract MP3 audio from a video:**
68
+
69
+ ```bash
70
+ vd -x --audio-format mp3 "URL"
71
+
72
+ ```
73
+
74
+ **Download specific items from a playlist:**
75
+
76
+ ```bash
77
+ vd -I 1:5,10 "PLAYLIST_URL"
78
+
79
+ ```
80
+
81
+ **Force IPv4 and use a proxy:**
82
+
83
+ ```bash
84
+ vd -4 --proxy "socks5://127.0.0.1:1080" "URL"
85
+
86
+ ```
87
+
88
+ ## ⚙️ Requirements
89
+
90
+ - **FFmpeg (Optional):** Required for merging video/audio tracks, extracting audio, or embedding metadata.
91
+ - **Node.js:** Required for installation via npm.
92
+
93
+ ---
94
+ License: MIT ([LICENSE](LICENSE))
95
+ ---
96
+
97
+ Built with ❤️ by [Saimon](https://nextsaimon.com/)
package/index.js ADDED
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require("child_process");
4
+ const path = require("path");
5
+ const os = require("os");
6
+ const fs = require("fs");
7
+ const https = require("https");
8
+
9
+ const platform = os.platform();
10
+ const arch = os.arch();
11
+ const version = "1.0.0";
12
+
13
+ let binaryName = "";
14
+ if (platform === "win32") {
15
+ binaryName = arch === "arm64" ? "vd-win-arm.exe" : "vd-win.exe";
16
+ } else if (platform === "linux") {
17
+ binaryName = "vd-linux";
18
+ } else if (platform === "darwin") {
19
+ binaryName = arch === "arm64" ? "vd-macos-arm" : "vd-macos-intel";
20
+ }
21
+
22
+ const binDir = path.join(__dirname, "bin");
23
+ const binaryPath = path.join(binDir, binaryName);
24
+ const downloadUrl = `https://github.com/nextsaimon/vd/releases/download/v${version}/${binaryName}`;
25
+
26
+ function download(url, dest) {
27
+ return new Promise((resolve, reject) => {
28
+ https
29
+ .get(url, (res) => {
30
+ if (
31
+ res.statusCode >= 300 &&
32
+ res.statusCode < 400 &&
33
+ res.headers.location
34
+ ) {
35
+ return download(res.headers.location, dest)
36
+ .then(resolve)
37
+ .catch(reject);
38
+ }
39
+ if (res.statusCode !== 200) {
40
+ return reject(new Error(`Failed to download: ${res.statusCode}`));
41
+ }
42
+ const file = fs.createWriteStream(dest);
43
+ res.pipe(file);
44
+ file.on("finish", () => {
45
+ file.close();
46
+ if (platform !== "win32") fs.chmodSync(dest, 0o755);
47
+ resolve();
48
+ });
49
+ })
50
+ .on("error", (err) => {
51
+ fs.unlink(dest, () => {});
52
+ reject(err);
53
+ });
54
+ });
55
+ }
56
+
57
+ async function run() {
58
+ if (!fs.existsSync(binaryPath)) {
59
+ if (!fs.existsSync(binDir)) fs.mkdirSync(binDir);
60
+ console.log(`Downloading vd binary for ${platform}...`);
61
+ await download(downloadUrl, binaryPath);
62
+ console.log("Download complete.\n");
63
+ }
64
+
65
+ const args = process.argv.slice(2);
66
+ const child = spawn(binaryPath, args, { stdio: "inherit" });
67
+ child.on("close", (code) => process.exit(code || 0));
68
+ }
69
+
70
+ run().catch((err) => {
71
+ console.error("Error:", err.message);
72
+ process.exit(1);
73
+ });
package/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "vd-go",
3
+ "version": "1.0.1",
4
+ "description": "High-performance video downloader CLI using Go",
5
+ "main": "index.js",
6
+ "preferGlobal": true,
7
+ "bin": {
8
+ "vd": "index.js"
9
+ },
10
+ "files": [
11
+ "index.js",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "author": "Saimon",
16
+ "license": "MIT"
17
+ }