baileyz 1.0.2 β†’ 1.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 CHANGED
@@ -48,6 +48,10 @@ pnpm add baileyz
48
48
 
49
49
  ---
50
50
 
51
+ <details>
52
+
53
+ <summary><strong>Click to expand: Baileyz Some Usage Things</strong></summary>
54
+
51
55
  ## πŸ“– Quick Start
52
56
 
53
57
  1. **Initialize the Socket**:
@@ -364,6 +368,236 @@ await sock.sendMessage(jid, {
364
368
  }, { quoted: m });
365
369
  ```
366
370
 
371
+ </details>
372
+
373
+ ---
374
+
375
+ ## πŸ“Ί YouTube Downloader & Search Usage Examples
376
+
377
+ <details>
378
+
379
+ <summary><strong>Click to expand: YouTube Downloader & Search Usage Examples</strong></summary>
380
+
381
+ ### 1️⃣ YouTube Search
382
+
383
+ **JavaScript:**
384
+
385
+ ```javascript
386
+
387
+ const { search } = require('baileyz');
388
+
389
+ console.log('=== Testing Search ===');
390
+ search('rick astley never gonna give you up', { limit: 5 })
391
+ .then(results => {
392
+ console.log('Search Results:', results);
393
+ console.log('First result title:', results[0].title);
394
+ console.log('First result URL:', results[0].url);
395
+ })
396
+ .catch(err => console.error('Search Error:', err.message));
397
+
398
+ ```
399
+
400
+ **Python:**
401
+
402
+ ```python
403
+
404
+ import subprocess, json
405
+ command = 'node -e "const { search } = require(\'baileyz\'); search(\'coding tutorial\', { limit: 5 }).then(r => console.log(JSON.stringify(r)))"'
406
+ result = subprocess.getoutput(command)
407
+ data = json.loads(result)
408
+ print(data)
409
+
410
+ ```
411
+
412
+ ### 2️⃣ Download YouTube Audio (MP3) with Random Quality (Default)
413
+
414
+ **JavaScript:**
415
+
416
+ ```javascript
417
+
418
+ const { ytmp3 } = require('baileyz');
419
+
420
+ console.log('=== Testing ytmp3 with random quality (passing null) ===');
421
+ ytmp3('https://www.youtube.com/watch?v=dQw4w9WgXcQ', null)
422
+ .then(result => {
423
+ console.log('Random MP3 Result (quality:', result.quality, '):');
424
+ console.log('Title:', result.title);
425
+ console.log('Download URL:', result.downloadUrl);
426
+ })
427
+ .catch(err => console.error('Random MP3 Error:', err.message));
428
+
429
+ ```
430
+
431
+ **Python:**
432
+
433
+ ```python
434
+
435
+ import subprocess, json
436
+ command = 'node -e "const { ytmp3 } = require(\'baileyz\'); ytmp3(\'https://www.youtube.com/watch?v=dQw4w9WgXcQ\', null).then(r => console.log(JSON.stringify(r)))"'
437
+ result = subprocess.getoutput(command)
438
+ data = json.loads(result)
439
+ print(data)
440
+
441
+ ```
442
+
443
+ ### 3️⃣ Download YouTube Audio (MP3) with Specific Quality
444
+
445
+ **JavaScript:**
446
+
447
+ ```javascript
448
+
449
+ const { ytmp3 } = require('baileyz');
450
+
451
+ console.log('=== Testing ytmp3 with explicit quality (128k) ===');
452
+ ytmp3('https://www.youtube.com/watch?v=dQw4w9WgXcQ', '128k')
453
+ .then(result => {
454
+ console.log('Title:', result.title);
455
+ console.log('Author:', result.author);
456
+ console.log('Format:', result.format);
457
+ console.log('Quality:', result.quality);
458
+ console.log('Download URL:', result.downloadUrl);
459
+ })
460
+ .catch(err => console.error('Explicit MP3 Error:', err.message));
461
+
462
+ ```
463
+
464
+ **Python:**
465
+
466
+ ```python
467
+
468
+ import subprocess, json
469
+ command = 'node -e "const { ytmp3 } = require(\'baileyz\'); ytmp3(\'https://www.youtube.com/watch?v=dQw4w9WgXcQ\', \'128k\').then(r => console.log(JSON.stringify(r)))"'
470
+ result = subprocess.getoutput(command)
471
+ data = json.loads(result)
472
+ print(data)
473
+
474
+ ```
475
+
476
+ ### 4️⃣ Download YouTube Video (MP4) with Random Quality (Default)
477
+
478
+ **JavaScript:**
479
+
480
+ ```javascript
481
+
482
+ const { ytmp4 } = require('baileyz');
483
+
484
+ console.log('=== Testing ytmp4 with random quality (passing null) ===');
485
+ ytmp4('https://www.youtube.com/watch?v=dQw4w9WgXcQ', null)
486
+ .then(result => {
487
+ console.log('Random MP4 Result (quality:', result.quality, '):');
488
+ console.log('Title:', result.title);
489
+ console.log('Download URL:', result.downloadUrl);
490
+ })
491
+ .catch(err => console.error('Random MP4 Error:', err.message));
492
+
493
+ ```
494
+
495
+ **Python:**
496
+
497
+ ```python
498
+
499
+ import subprocess, json
500
+ command = 'node -e "const { ytmp4 } = require(\'baileyz\'); ytmp4(\'https://www.youtube.com/watch?v=dQw4w9WgXcQ\', null).then(r => console.log(JSON.stringify(r)))"'
501
+ result = subprocess.getoutput(command)
502
+ data = json.loads(result)
503
+ print(data)
504
+
505
+ ```
506
+
507
+ ### 5️⃣ Download YouTube Video (MP4) with Specific Resolution
508
+
509
+ **JavaScript:**
510
+
511
+ ```javascript
512
+
513
+ const { ytmp4 } = require('baileyz');
514
+
515
+ console.log('=== Testing ytmp4 with explicit quality (360p) ===');
516
+ ytmp4('https://www.youtube.com/watch?v=dQw4w9WgXcQ', '360p')
517
+ .then(result => {
518
+ console.log('Title:', result.title);
519
+ console.log('Author:', result.author);
520
+ console.log('Format:', result.format);
521
+ console.log('Quality:', result.quality);
522
+ console.log('Download URL:', result.downloadUrl);
523
+ })
524
+ .catch(err => console.error('Explicit MP4 Error:', err.message));
525
+
526
+ ```
527
+
528
+ **Python:**
529
+
530
+ ```python
531
+
532
+ import subprocess, json
533
+ command = 'node -e "const { ytmp4 } = require(\'baileyz\'); ytmp4(\'https://www.youtube.com/watch?v=dQw4w9WgXcQ\', \'360p\').then(r => console.log(JSON.stringify(r)))"'
534
+ result = subprocess.getoutput(command)
535
+ data = json.loads(result)
536
+ print(data)
537
+
538
+ ```
539
+
540
+ ### 6️⃣ Saving Files to Disk
541
+
542
+ Use the options object `{ path: './filename.ext' }` to save files directly.
543
+
544
+ **JavaScript (MP3 Save Example):**
545
+
546
+ ```javascript
547
+
548
+ const { ytmp3 } = require('baileyz');
549
+
550
+ const path = require('path');
551
+
552
+ const savePath = path.join(__dirname, 'test_audio.mp3');
553
+
554
+ ytmp3('https://www.youtube.com/watch?v=dQw4w9WgXcQ', '128k', { path: savePath })
555
+ .then(result => {
556
+ console.log('Title:', result.title);
557
+ console.log('Author:', result.author);
558
+ console.log('Format:', result.format);
559
+ console.log('Quality:', result.quality);
560
+ console.log('Saved to:', result.savedTo);
561
+ })
562
+ .catch(err => console.error('Save Error:', err.message));
563
+
564
+ ```
565
+
566
+ **JavaScript (MP4 Save Example):**
567
+
568
+ ```javascript
569
+
570
+ const { ytmp4 } = require('baileyz');
571
+
572
+ const path = require('path');
573
+ const savePath = path.join(__dirname, 'test_video.mp4');
574
+ ytmp4('https://www.youtube.com/watch?v=dQw4w9WgXcQ', '360p', { path: savePath })
575
+ .then(result => {
576
+ console.log('Title:', result.title);
577
+ console.log('Author:', result.author);
578
+ console.log('Format:', result.format);
579
+ console.log('Quality:', result.quality);
580
+ console.log('Saved to:', result.savedTo);
581
+ })
582
+ .catch(err => console.error('Save Error:', err.message));
583
+
584
+ ```
585
+
586
+ **Python (MP3 Save Example):**
587
+
588
+ ```python
589
+
590
+ import subprocess, json
591
+
592
+ command = 'node -e "const { ytmp3 } = require(\'baileyz\'); ytmp3(\'https://www.youtube.com/watch?v=dQw4w9WgXcQ\', \'128k\', { path: \'./audio.mp3\' }).then(r => console.log(JSON.stringify(r)))"'
593
+ result = subprocess.getoutput(command)
594
+ data = json.loads(result)
595
+ print(data)
596
+
597
+ ```
598
+
599
+ </details>
600
+
367
601
  ---
368
602
 
369
603
  ## πŸš€ Why Baileyz?
@@ -373,6 +607,7 @@ In a sea of WhatsApp libraries, Baileyz stands out with:
373
607
  - **Future-Proof**: Proactive updates for WhatsApp's evolving APIβ€”multi-device, interactive v2, and beyond.
374
608
  - **Developer-First**: TypeScript natives, zero-config auth, and hookable events for custom logic.
375
609
  - **Production-Grade**: Powers 10k+ sessions daily in bots from startups to enterprises.
610
+ - **Built-in Media Magic**: Seamless YouTube integration via `ytmp4`/`ytmp3`/`search` for instant audio/video downloadsβ€”perfect for media bots. Fetch, convert, and send MP3s in seconds without extra deps.
376
611
 
377
612
  Switch to Baileyz for automation that just *works*.
378
613
 
@@ -386,7 +621,7 @@ MIT Β© [DanuZz](https://danuzz.movanest.xyz). See [LICENSE](https://github.com/D
386
621
 
387
622
  ## πŸ“ž Support & Contact
388
623
 
389
- - **Main Site**: [baileyz.dev](https://www.movanest.xyz)
624
+ - **Main Site**: [MovaNest](https://www.movanest.xyz)
390
625
  - **Contact Site**: [@DanuZz](https://danuzz.movanest.xyz)
391
626
 
392
627
  **Built with ❀️ for the WhatsApp dev community. Let's automate the future!** πŸš€
@@ -2,9 +2,18 @@ const major = parseInt(process.versions.node.split('.')[0], 10);
2
2
 
3
3
  if (major < 20) {
4
4
  console.error(
5
- `\n❌ This package requires Node.js 20+ to run reliably.\n` +
6
- ` You are using Node.js ${process.versions.node}.\n` +
7
- ` Please upgrade to Node.js 20+ to proceed.\n`
5
+ `\n` +
6
+ `πŸ”΄ Oh no! 🚨\n` +
7
+ `\n` +
8
+ ` The package **baileyz** requires Node.js 20+ to run reliably.\n` +
9
+ ` You're currently on Node.js ${process.versions.node}. πŸ˜”\n` +
10
+ `\n` +
11
+ ` πŸ’‘ Quick fix: Upgrade to Node.js 20+ (recommended: latest LTS)!\n` +
12
+ ` Download from https://nodejs.org/ or use a version manager like nvm.\n` +
13
+ `\n` +
14
+ ` Once upgraded, try running your command again. πŸŽ‰\n` +
15
+ `\n` +
16
+ ` (Exiting now to avoid any issues...)\n`
8
17
  );
9
18
  process.exit(1);
10
- }
19
+ }
@@ -0,0 +1,4 @@
1
+ const dxzYtdl = require("dxz-ytdl");
2
+ const { ytmp3, ytmp4, search } = dxzYtdl;
3
+
4
+ module.exports = { ytmp3, ytmp4, search };
package/lib/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  const chalk = require("chalk");
4
+ const { ytmp3, ytmp4, search } = require("./MediaDl/Ytdl/ytdl.js");
4
5
 
5
6
  console.log(chalk.magentaBright.bold("\n" + "╔══════════════════════════════════════════════╗" + "\n"));
6
- console.log(chalk.magentaBright.bold("β•‘" + chalk.whiteBright(" ✨ DanuZz Baileyz ✨ ") + "β•‘" + "\n"));
7
+ console.log(chalk.magentaBright.bold("β•‘" + chalk.whiteBright(" ✨ DanuZz Baileyz ✨ ") + "β•‘" + "\n"));
7
8
  console.log(chalk.magentaBright.bold("β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•" + "\n"));
8
9
  console.log(chalk.whiteBright(" Hi, thank you for using my modified Baileys ^-^ "));
9
10
  console.log(chalk.cyan("Developer: ") + chalk.greenBright("@DanuZz"));
@@ -42,4 +43,7 @@ __exportStar(require("./WABinary"), exports);
42
43
  __exportStar(require("./WAM"), exports);
43
44
  __exportStar(require("./WAUSync"), exports);
44
45
 
46
+ exports.ytmp3 = ytmp3;
47
+ exports.ytmp4 = ytmp4;
48
+ exports.search = search;
45
49
  exports.default = Socket_1.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baileyz",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "WhatsApp Web API Library Modification By DanuZz",
5
5
  "keywords": [
6
6
  "whatsapp",
@@ -12,6 +12,7 @@
12
12
  "whatsapp-bot",
13
13
  "automation",
14
14
  "js-whatsapp",
15
+ "ytdl",
15
16
  "whatsapp-api",
16
17
  "baileys-mod",
17
18
  "botwa",
@@ -54,6 +55,7 @@
54
55
  "axios": "^1.3.3",
55
56
  "cache-manager": "4.0.1",
56
57
  "chalk": "^4.1.2",
58
+ "dxz-ytdl": "^1.0.2",
57
59
  "futoin-hkdf": "^1.5.1",
58
60
  "libphonenumber-js": "^1.10.20",
59
61
  "lodash": "^4.17.21",
package/lib/example DELETED
@@ -1 +0,0 @@
1
-