UNPKG

mr-chamuwa-downloader

Version:

๐Ÿ”ฅ MrChamuwa's Ultimate Facebook Video Downloader - The most powerful FB video downloading tool in Sri Lanka!

125 lines (107 loc) โ€ข 4.86 kB
const MrChamuwaFBDownloader = require('../src/index.js'); const chalk = require('chalk'); const boxen = require('boxen'); async function runMrChamuwaDemo() { console.log(boxen( chalk.rainbow('๐Ÿ”ฅ MrChamuwa FB Downloader Demo ๐Ÿ”ฅ\n') + chalk.cyan('The Ultimate Facebook Video Downloader\n') + chalk.yellow('Made with โค๏ธ in Sri Lanka ๐Ÿ‡ฑ๐Ÿ‡ฐ'), { padding: 1, borderStyle: 'double', borderColor: 'rainbow' } )); console.log(chalk.blue.bold('\n๐Ÿš€ Initializing MrChamuwa FB Downloader...\n')); // Initialize with Sinhala language const downloader = new MrChamuwaFBDownloader({ language: 'si', outputDir: './MrChamuwa-Demo-Downloads', quality: 'hd', saveMetadata: true, createSubfolders: true }); // Event listeners for demo downloader.on('ready', (message) => { console.log(chalk.green(`โœ… ${message}`)); }); downloader.on('start', (message) => { console.log(chalk.blue(`๐Ÿš€ ${message}`)); }); downloader.on('analyze', (message) => { console.log(chalk.yellow(`๐Ÿ” ${message}`)); }); downloader.on('progress', (data) => { if (data.progress > 0) { const percent = data.progress.toFixed(1); const speed = (data.speed / 1024 / 1024).toFixed(2); console.log(chalk.cyan(`๐Ÿ“Š Progress: ${percent}% | Speed: ${speed} MB/s`)); } }); downloader.on('completed', (result) => { console.log(chalk.green(`โœ… ${result.message}`)); console.log(chalk.cyan(`๐Ÿ“ File: ${result.fileName}`)); console.log(chalk.cyan(`๐Ÿ“Š Size: ${(result.size / 1024 / 1024).toFixed(2)} MB`)); }); downloader.on('error', (error) => { console.log(chalk.red(`โŒ ${error.message}`)); }); // Demo features console.log(chalk.yellow('๐Ÿ“‹ Demo Features:')); console.log(chalk.white('โœ… Multi-language support (Sinhala/English)')); console.log(chalk.white('โœ… Smart video extraction with multiple methods')); console.log(chalk.white('โœ… Progress tracking with speed and ETA')); console.log(chalk.white('โœ… Automatic retry mechanism')); console.log(chalk.white('โœ… Smart filename generation')); console.log(chalk.white('โœ… Metadata extraction and saving')); console.log(chalk.white('โœ… Organized folder structure')); console.log(chalk.white('โœ… Event-driven architecture')); console.log(chalk.white('โœ… Batch download support')); console.log(chalk.white('โœ… Beautiful CLI with interactive prompts\n')); // API Demo console.log(chalk.magenta.bold('๐Ÿ“š API Usage Examples:\n')); console.log(chalk.cyan('// Basic download')); console.log(chalk.white('const downloader = new MrChamuwaFBDownloader();')); console.log(chalk.white('const result = await downloader.downloadVideo(fbUrl);\n')); console.log(chalk.cyan('// With custom options')); console.log(chalk.white('const downloader = new MrChamuwaFBDownloader({')); console.log(chalk.white(' language: "si",')); console.log(chalk.white(' quality: "hd",')); console.log(chalk.white(' outputDir: "./downloads",')); console.log(chalk.white(' saveMetadata: true')); console.log(chalk.white('});\n')); console.log(chalk.cyan('// With progress tracking')); console.log(chalk.white('downloader.on("progress", (data) => {')); console.log(chalk.white(' console.log(`${data.progress}% completed`);')); console.log(chalk.white('});\n')); // Statistics const stats = downloader.getStats(); console.log(chalk.blue.bold('๐Ÿ“Š Current Statistics:')); console.log(chalk.white(`Session ID: ${stats.sessionId}`)); console.log(chalk.white(`Downloads: ${stats.totalDownloaded}`)); console.log(chalk.white(`Failed: ${stats.totalFailed}`)); console.log(chalk.white(`Success Rate: ${stats.successRate.toFixed(2)}%`)); console.log(chalk.white(`Total Size: ${(stats.totalSize / 1024 / 1024).toFixed(2)} MB\n`)); // Installation guide console.log(boxen( chalk.green.bold('๐Ÿ“ฆ INSTALLATION GUIDE\n\n') + chalk.cyan('1. Install from NPM:\n') + chalk.white(' npm install -g mr-chamuwa-downloader\n\n') + chalk.cyan('2. Use CLI:\n') + chalk.white(' chamuwa-fb download\n') + chalk.white(' mrchamuwa quick "fb-url"\n\n') + chalk.cyan('3. Use in Code:\n') + chalk.white(' const MrChamuwaFBDownloader = require("mr-chamuwa-downloader");\n') + chalk.white(' const downloader = new MrChamuwaFBDownloader();\n\n') + chalk.yellow('๐ŸŽ‰ Ready to download Facebook videos like a pro!'), { padding: 1, borderStyle: 'round', borderColor: 'green' } )); console.log(chalk.rainbow('\n๐Ÿ”ฅ MrChamuwa FB Downloader - เทƒเท”เถดเท’เถปเท’! ๐Ÿ”ฅ')); } if (require.main === module) { runMrChamuwaDemo().catch(console.error); }