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
JavaScript
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);
}