Skip to content

ขอโทษด้วยครับ เเต่ผมว่า 48 ชม มันไม่น่าพอสำหรับคนโง่ๆ เเบบผม นะครับ 🥲

License

Notifications You must be signed in to change notification settings

ImJustNon/Be-Engineer-Downloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Be Engineer Downloader 🎥

Node.js TypeScript FFmpeg

License Stars Forks Issues

โปรแกรมสำหรับดาวน์โหลดและถอดรหัสวิดีโอจาก Be Online แล้วแปลงเป็นไฟล์ MP4 คุณภาพสูง

A powerful tool for downloading and decrypting Be Online video streams, converting them to high-quality MP4 files


🌟 Features | คุณสมบัติ

🚀 Core Features

  • 🔄 Automated Stream Download - Downloads encrypted TS segments sequentially
  • 🔐 AES-128-CBC Decryption - Automatic decryption with validation
  • 🎬 MP4 Conversion - High-quality video output with FFmpeg
  • Resume Support - Continue from specific segments
  • 🛡️ Integrity Checking - Validates file completeness automatically

🎯 Advanced Features

  • 📊 Progress Tracking - Real-time download progress
  • 🗂️ Smart File Management - Organized cache and output structure
  • 🔧 Flexible Configuration - Multiple identifier patterns support
  • 📝 Detailed Logging - Comprehensive operation logs
  • 🧹 Auto Cleanup - Automatic cache management

📋 System Requirements | ความต้องการของระบบ

Component Version Status
Node.js >= 16.0.0 Required
FFmpeg >= 4.0.0 Required
TypeScript >= 4.5.0 Included
Memory >= 1GB RAM Recommended
Storage >= 5GB Free Recommended

🚀 Quick Start | การติดตั้ง

📖 Need detailed setup instructions? Check out our Complete Setup Guide for platform-specific installation steps, troubleshooting, and verification.

📦 Installation

🖥️ Step 1: Clone Repository
# Clone the repository
git clone https://github.com/ImJustNon/Be-Engineer-Downloader.git

# Navigate to project directory
cd Be-Engineer-Downloader

# Check if git clone was successful
ls -la
📚 Step 2: Install Dependencies
# Install all required packages
npm install

# Verify installation
npm list --depth=0
🎬 Step 3: Install FFmpeg

Choose your operating system:

OS Command Package Manager
macOS brew install ffmpeg Homebrew
Windows choco install ffmpeg Chocolatey
Ubuntu/Debian sudo apt update && sudo apt install ffmpeg APT
CentOS/RHEL sudo yum install ffmpeg YUM
Arch Linux sudo pacman -S ffmpeg Pacman
Manual Download from official site -

Verify FFmpeg installation:

ffmpeg -version

⚙️ Configuration | การตั้งค่า

🔑 Step 1: Obtain Encryption Key

⚠️ Important: The encryption key is required and must be obtained from the video source.

🔍 How to Find Encryption Key
  1. Open Browser Developer Tools

    • Press F12 or Ctrl+Shift+I (Windows/Linux)
    • Press Cmd+Option+I (macOS)
  2. Navigate to Network Tab

    • Click on the "Network" tab
    • Enable "Preserve log" if available
  3. Filter Network Requests

    Filter by: .key OR .m3u8 OR encryption
    
  4. Play the Target Video

    • Start playing the video you want to download
    • Watch for network requests
  5. Locate Key File

    • Look for files named like:
      • encryption.key
      • key.key
      • *.key
    • Right-click → "Save as..." → enckeybeonline.key
  6. Place in Project Root

    Be-Engineer-Downloader/
    ├── enckeybeonline.key    ← Place your key file here
    ├── package.json
    └── src/
    

🛠️ Step 2: Configure Application

Edit src/index.ts with your video details:

const beeng = new BeEngDL({
    startSegment: 0,           // Starting segment (usually 0)
    url: "YOUR_VIDEO_URL",     // Video stream URL
    identifier: "<<>>",        // Segment number placeholder
    encryptKey: ""            // Leave empty (reads from key file)
});
📋 Configuration Parameters
Parameter Type Description Example
startSegment number First segment to download 0, 10, 50
url string Base URL with identifier See URL section
identifier string Segment placeholder "<<>>", "[]", "$$$"
encryptKey string Leave empty (auto-loaded) ""

🔍 URL Discovery Guide | วิธีหา URL และตั้งค่า

🎯 Finding Stream URLs

📊 Step-by-Step URL Discovery
  1. Open Developer Tools

    F12 → Network Tab → Enable "Preserve log"
    
  2. Set Network Filters

    Filter: .ts OR .m3u8 OR segment
    
  3. Play Target Video

    • Start video playback
    • Let it buffer for a few seconds
  4. Identify Segment Pattern Look for URLs like:

    segment-0.ts
    0.ts  
    chunk_000000.ts
    video_001.ts
    
  5. Extract Base URL From the segment URL, remove the number part

🔄 URL Transformation Examples

Original Segment URL Transformed URL Identifier
.../Introduction0.ts
.../Introduction<<>>.ts
"<<>>"
.../segment_123.ts
.../segment_[].ts
"[]"
.../chunk000456.ts
.../chunk$$$456.ts
"$$$"

📝 Complete Configuration Example

// Example configuration for Be Online video
const beeng = new BeEngDL({
    startSegment: 0,
    url: "https://vdo.inclass.me/beonline/course/video<<>>.ts",
    identifier: "<<>>",
    encryptKey: "" // Auto-loaded from enckeybeonline.key
});
🔧 Advanced URL Patterns

Common identifier patterns:

  • <<>> - Most common for Be Online
  • [] - Alternative bracket style
  • $$$ - Dollar sign placeholder
  • ### - Hash placeholder
  • {num} - Brace style

URL validation checklist:

  • ✅ Base URL is accessible
  • ✅ Identifier correctly placed
  • ✅ First segment (0) exists
  • ✅ Pattern matches actual segments

📁 โครงสร้างโฟลเดอร์

Be-Engineer-Downloader/
├── 📄 enckeybeonline.key          # ไฟล์ encryption key
├── 📄 package.json
├── 📄 tsconfig.json
├── 📁 cache/                      # ไฟล์ชั่วคราว
│   ├── 📁 ffmpeg/                 # ไฟล์สำหรับ FFmpeg
│   └── 📁 stream/
│       ├── 📁 encrypted/          # ไฟล์ TS ที่เข้ารหัส
│       └── 📁 decrypted/          # ไฟล์ TS ที่ถอดรหัสแล้ว
├── 📁 output/                     # ไฟล์ MP4 ที่เสร็จแล้ว
└── 📁 src/
    ├── 📄 index.ts               # ไฟล์หลัก
    └── 📁 class/
        ├── 📄 BeEngDL.class.ts    # คลาสหลัก
        ├── 📄 Convert.class.ts    # การแปลงไฟล์
        ├── 📄 DecryptTS.class.ts  # การถอดรหัส
        └── 📄 DownloadTS.class.ts # การดาวน์โหลด

🎯 Usage Guide | วิธีใช้งาน

🚀 Running the Application

# Start the download process
npm run dev

# Alternative: Direct TypeScript execution
npx tsx src/index.ts

🔄 Processing Pipeline

graph LR
    A[🎬 Video URL] --> B[📥 Download Segments]
    B --> C[🔐 Decrypt Files]
    C --> D[🎞️ Merge & Convert]
    D --> E[✅ MP4 Output]
Loading
📋 Stage 1: Download Encrypted Segments
🔄 Processing Stage 1/3: Download
┌─────────────────────────────────────┐
│ • Fetching segment URLs sequentially│
│ • Downloading encrypted TS files    │
│ • Storing in cache/stream/encrypted/│
│ • Auto-detecting end of stream      │
└─────────────────────────────────────┘

What happens:

  • Downloads segments starting from startSegment
  • Continues until HTTP 404 (end of stream)
  • Stores encrypted files temporarily
  • Provides real-time progress updates
🔓 Stage 2: Decrypt Files
🔐 Processing Stage 2/3: Decrypt
┌─────────────────────────────────────┐
│ • Loading encryption key from file  │
│ • Applying AES-128-CBC decryption   │
│ • Validating TS sync byte (0x47)    │
│ • Storing in cache/stream/decrypted/│
└─────────────────────────────────────┘

What happens:

  • Reads enckeybeonline.key automatically
  • Decrypts each segment using AES-128-CBC
  • Validates file integrity (TS sync byte)
  • Skips corrupted segments
🎬 Stage 3: Merge & Convert
🎞️ Processing Stage 3/3: Convert
┌─────────────────────────────────────┐
│ • Creating FFmpeg concat list       │
│ • Merging all TS segments          │
│ • Converting to MP4 format         │
│ • Optimizing for playback          │
└─────────────────────────────────────┘

What happens:

  • Generates FFmpeg input file list
  • Concatenates segments in correct order
  • Converts to MP4 with optimal settings
  • Outputs final video file

📊 Sample Output Log

🔍 View Complete Process Log
🎬 Be Engineer Downloader v1.0.0
================================================

📥 Step 1) Download TS Stream file with encryption
[ Info ] Deleted /cache/stream dir
[ Info ] Created /cache/stream dir
[ Info ] Starting download from segment: 0

⏳ Downloading segments...
✅ write file success : 0 (2.1 MB)
✅ write file success : 1 (2.3 MB)  
✅ write file success : 2 (2.0 MB)
...
✅ write file success : 149 (1.8 MB)
❌ Segment 150: 404 Not Found (End of stream)

📊 Download Summary:
   • Total segments: 150
   • Total size: 312.5 MB
   • Duration: 2m 34s
   • Status: ✅ Complete

🔐 Step 2) Decrypt segments
[ Info ] Loading encryption key: enckeybeonline.key
[ Info ] Starting decryption process...

🔓 Decrypting segments...
✅ Decrypted: stream-segment-0.ts (sync: 0x47 ✓)
✅ Decrypted: stream-segment-1.ts (sync: 0x47 ✓)
...
✅ Decrypted: stream-segment-149.ts (sync: 0x47 ✓)

📊 Decryption Summary:
   • Processed: 150/150 segments
   • Success rate: 100%
   • Status: ✅ Complete

🎞️ Step 3) Concat and Convert to MP4
[ Info ] Creating file list for FFmpeg
[ Info ] Found 150 decrypted TS files
[ Info ] Converting to MP4...

🎬 FFmpeg Processing...
frame= 7200 fps= 85 q=28.0 size=  187392kB time=00:04:00.00
✅ Conversion complete!

📊 Final Output:
   • File: Physics1_M2_Introduction.mp4
   • Size: 245.7 MB
   • Duration: 4:00:15
   • Resolution: 1920x1080
   • Status: ✅ Ready for playback

🎉 Process completed successfully!

🛠️ การตั้งค่าขั้นสูง

การปรับแต่ง Identifier

โปรแกรมรองรับ identifier หลายแบบ:

// สำหรับ URL ที่ใช้ <<>>
identifier: "<<>>"

// สำหรับ URL ที่ใช้ []
identifier: "[]"

// สำหรับ URL ที่ใช้ $$$
identifier: "$$$"

// หรือสตริงอื่นๆ ตามต้องการ
identifier: "SEGMENT_NUMBER"

การเริ่มจากเซกเมนต์ที่กำหนด

const beeng = new BeEngDL({
    startSegment: 50,  // เริ่มจากเซกเมนต์ที่ 50
    url: "...",
    identifier: "<<>>",
    encryptKey: ""
});

🔧 Troubleshooting | การแก้ไขปัญหา

🚨 Common Issues & Solutions

❌ FFmpeg Not Found

Error Message:

Error: ffmpeg not found
Command failed: ffmpeg -version

Solutions:

  1. Install FFmpeg:

    # macOS
    brew install ffmpeg
    
    # Windows  
    choco install ffmpeg
    
    # Ubuntu/Debian
    sudo apt install ffmpeg
  2. Verify Installation:

    ffmpeg -version
    which ffmpeg  # Check PATH
  3. Manual PATH Setup:

    export PATH="/path/to/ffmpeg/bin:$PATH"
🔑 Encryption Key Issues

Error Messages:

Error: ENOENT: no such file or directory, open 'enckeybeonline.key'
[ Error ] Fail to decrypt : stream-segment-X.ts

Solutions:

  1. Check Key File Location:

    ls -la enckeybeonline.key  # Should be in project root
  2. Verify Key File Content:

    file enckeybeonline.key    # Should show: data
    hexdump -C enckeybeonline.key | head  # Should show binary data
  3. Re-obtain Key:

    • Use browser DevTools → Network tab
    • Filter by .key files
    • Download correct encryption key
🌐 URL & Network Issues

Error Messages:

404 Not Found
Connection timeout
ENOTFOUND domain.com

Diagnostic Commands:

# Test URL accessibility
curl -I "YOUR_SEGMENT_URL_HERE"

# Test with first segment (replace <<>> with 0)
curl -I "https://example.com/video0.ts"

# Check DNS resolution
nslookup your-domain.com

Solutions:

  1. Verify URL Pattern:

    • Check identifier placement
    • Test first segment manually
    • Confirm segment numbering
  2. Network Issues:

    # Check internet connection
    ping google.com
    
    # Try with different DNS
    export DNS_SERVER=8.8.8.8
💾 Storage & Permission Issues

Error Messages:

EACCES: permission denied
ENOSPC: no space left on device

Solutions:

  1. Check Disk Space:

    df -h .                    # Check available space
    du -sh cache/ output/      # Check folder sizes
  2. Fix Permissions:

    chmod 755 .                # Fix directory permissions
    sudo chown -R $USER:$USER . # Fix ownership
  3. Clean Cache:

    rm -rf cache/              # Clean temporary files
    mkdir -p cache/stream/{encrypted,decrypted}

🛠️ System Diagnostics

🔍 Quick System Check

Run this comprehensive check:

#!/bin/bash
echo "🔍 Be Engineer Downloader - System Diagnostics"
echo "=============================================="

echo "📦 Node.js Version:"
node --version || echo "❌ Node.js not installed"

echo "🎬 FFmpeg Version:"
ffmpeg -version 2>/dev/null | head -1 || echo "❌ FFmpeg not installed"

echo "📁 Project Structure:"
ls -la enckeybeonline.key 2>/dev/null && echo "✅ Key file exists" || echo "❌ Key file missing"
ls -la package.json 2>/dev/null && echo "✅ Package.json exists" || echo "❌ Package.json missing"

echo "💾 Disk Space:"
df -h . | tail -1

echo "🔧 Dependencies:"
npm list --depth=0 2>/dev/null | grep -E "(axios|typescript)" || echo "❌ Dependencies missing"

echo "=============================================="
echo "✅ Diagnostic complete"

📞 Getting Help

Issue Type Contact Method Response Time
🐛 Bugs GitHub Issues 24-48 hours
❓ Questions Discussions 1-3 days
💡 Features Feature Request 1 week

📚 API Reference | เอกสารการใช้งาน

🏗️ BeEngDL Class

🔧 Constructor Options
interface BeEngOptionSpecs {
    startSegment: number;    // Starting segment number
    url: string;            // Video stream URL with identifier
    identifier: string;     // Placeholder for segment numbers
    encryptKey: string;     // Leave empty (auto-loaded)
}
Parameter Type Required Description Example
startSegment number First segment to download 0, 10, 50
url string Stream URL with placeholder "https://example.com/video<<>>.ts"
identifier string Segment number placeholder "<<>>", "[]", "$$$"
encryptKey string Leave empty (auto-loaded) ""
⚡ Methods

download(): Promise<void>

Downloads encrypted TS segments sequentially.

await beeng.download();

Features:

  • ✅ Automatic segment detection
  • ✅ Progress tracking
  • ✅ Error handling & retry logic
  • ✅ Cache management

decrypt(): Promise<void>

Decrypts downloaded segments using AES-128-CBC.

await beeng.decrypt();

Features:

  • ✅ Automatic key loading
  • ✅ TS sync byte validation
  • ✅ Batch processing
  • ✅ Error reporting

concatAndConvert(): Promise<void>

Merges decrypted segments into MP4.

await beeng.concatAndConvert();

Features:

  • ✅ FFmpeg integration
  • ✅ Optimal MP4 encoding
  • ✅ File size optimization
  • ✅ Quality preservation

🎯 Usage Patterns

📖 Basic Usage
import { BeEngDL } from "./class/BeEngDL.class";

const downloader = new BeEngDL({
    startSegment: 0,
    url: "https://example.com/video<<>>.ts",
    identifier: "<<>>",
    encryptKey: ""
});

// Sequential processing
await downloader.download();
await downloader.decrypt();
await downloader.concatAndConvert();
🔄 Advanced Usage
// Resume from specific segment
const resumeDownloader = new BeEngDL({
    startSegment: 50,  // Resume from segment 50
    url: "https://example.com/video<<>>.ts",
    identifier: "<<>>",
    encryptKey: ""
});

// Error handling
try {
    await resumeDownloader.download();
    console.log("✅ Download completed");
    
    await resumeDownloader.decrypt();
    console.log("✅ Decryption completed");
    
    await resumeDownloader.concatAndConvert();
    console.log("✅ Conversion completed");
    
} catch (error) {
    console.error("❌ Process failed:", error);
}

🤝 Contributing | การมีส่วนร่วม

🌟 We Welcome Contributions!

Contributors Pull Requests Welcome Good First Issues

🚀 Quick Contribution Guide
  1. Fork & Clone

    git clone https://github.com/YOUR_USERNAME/Be-Engineer-Downloader.git
    cd Be-Engineer-Downloader
  2. Create Branch

    git checkout -b feature/your-feature-name
  3. Make Changes

    • Follow existing code style
    • Add tests if applicable
    • Update documentation
  4. Commit & Push

    git commit -m "✨ Add: your feature description"
    git push origin feature/your-feature-name
  5. Create Pull Request

    • Use descriptive title
    • Explain changes made
    • Reference related issues

📄 License | ลิขสิทธิ์

License

Non-Commercial License - Free for personal and educational use

View Full License | Commercial Licensing Inquiries


🙏 Acknowledgments | กิตติกรรมประกาศ

💎 Built With

TypeScript Node.js FFmpeg

🎯 Special Thanks

  • FFmpeg Team - For excellent video processing tools
  • Node.js Community - For the robust ecosystem
  • TypeScript Team - For type safety and developer experience
  • Contributors - For making this project better

⚠️ Disclaimer | ข้อปฏิเสธความรับผิดชอบ

Educational Purpose Only

This tool is created for educational and research purposes only. Please respect copyright laws and terms of service of content providers. Users are responsible for ensuring their usage complies with applicable laws and regulations.

โปรแกรมนี้สร้างขึ้นเพื่อการศึกษาเท่านั้น กรุณาใช้งานภายในกรอบกฎหมายลิขสิทธิ์


📞 Support & Contact | ติดต่อสอบถาม

GitHub Issues GitHub Discussions

Made with ❤️ by ImJustNon

If this project helped you, please consider giving it a star!


📚 Documentation

Guide Description Link
🚀 Setup Guide Complete installation and configuration docs/SETUP.md
📖 Usage Guide Detailed usage examples and best practices docs/USAGE.md
🔧 Troubleshooting Common issues and solutions README.md#troubleshooting

About

ขอโทษด้วยครับ เเต่ผมว่า 48 ชม มันไม่น่าพอสำหรับคนโง่ๆ เเบบผม นะครับ 🥲

Topics

Resources

License

Stars

Watchers

Forks