cli-cobalt 1.0.0

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 ADDED
@@ -0,0 +1,37 @@
1
+ # Cobalt unofficial CLI
2
+ ![Cobalt Banner](banner.png)
3
+
4
+ I made this because of a [tweet](https://x.com/justusecobalt/status/1788828537908068668) the [Cobalt Twitter Account](https://twitter.com/justusecobalt)
5
+
6
+ ## installation
7
+
8
+ ### NPM
9
+ ```
10
+ npm i -g cobalt-cli
11
+ ```
12
+
13
+ ### PNPM
14
+ ```
15
+ pnpm i -g cobalt-cli
16
+ ```
17
+
18
+ ### Bun
19
+ ```
20
+ bun i -g cobalt-cli
21
+ ```
22
+
23
+ ### Yarn
24
+ idk, I don't use yarn get real
25
+
26
+ ## Usage
27
+ ```
28
+ ```
29
+ cobalt -l <link> -o <output file>
30
+ ```
31
+ For example:
32
+ ```
33
+ cobalt -l https://www.youtube.com/watch?v=dQw4w9WgXcQ -o ./never_let_me_down.mp4
34
+ ```
35
+
36
+ ## Final note:
37
+ Please don't actually use this, this thing actually sucks.
package/banner.png ADDED
Binary file
package/index.js ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { program } from "commander";
4
+ import chalk from "chalk";
5
+ import axios from "axios";
6
+ import fs from "fs";
7
+ import { fileURLToPath } from 'url';
8
+ import { dirname } from 'path';
9
+
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = dirname(__filename);
12
+
13
+ const apiLink = "https://co.wuk.sh/"
14
+ const api = axios.create({
15
+ baseURL: apiLink,
16
+ });
17
+
18
+ program
19
+ .version("1.0.0")
20
+ .description("Unofficial Cobalt CLI")
21
+ .option("-l, --link <type>", "Link to youtube video")
22
+ .option("-o, --output <type>", "Output file path")
23
+ .action((options) => {
24
+ api.post('/api/json', {
25
+ url: options.link
26
+ }, {
27
+ headers: {
28
+ 'Content-Type': 'application/json',
29
+ Accept: 'application/json'
30
+ }
31
+ }).then(data => {
32
+ const streamUrl = data.data.url;
33
+
34
+ // Download from the stream url
35
+ api.get(streamUrl, {
36
+ responseType: 'stream'
37
+ }).then(response => {
38
+ const path = `${__dirname}/${options.output}`
39
+ const writer = fs.createWriteStream(path);
40
+ response.data.pipe(writer);
41
+
42
+ writer.on('finish', () => {
43
+ console.log(chalk.green("Downloaded successfully!"));
44
+ });
45
+
46
+ writer.on('error', (err) => {
47
+ console.log(chalk.red("Error: " + err));
48
+ });
49
+ }).catch(err => {
50
+ console.log(chalk.red("Error: " + err));
51
+ });
52
+ })
53
+ });
54
+
55
+ program.parse(process.argv);
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "cli-cobalt",
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1"
7
+ },
8
+ "author": "",
9
+ "license": "ISC",
10
+ "description": "",
11
+ "dependencies": {
12
+ "axios": "^1.6.8",
13
+ "chalk": "^5.3.0",
14
+ "commander": "^12.0.0"
15
+ },
16
+ "bin": {
17
+ "cobalt": "index.js"
18
+ },
19
+ "type": "module"
20
+ }