Skip to content

Commit 2ce2ab4

Browse files
author
Hamas
committed
Final Update: README and Native Muxer Polish
1 parent a0aca68 commit 2ce2ab4

File tree

21 files changed

+442
-217
lines changed

21 files changed

+442
-217
lines changed

README.md

Lines changed: 31 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -3,185 +3,64 @@
33
> **The World's First Pure-Dart, Zero-FFmpeg Media Engine for 8K Performance & 1,000+ Site Scalability.**
44
55
[![Pure Dart](https://img.shields.io/badge/Pure-Dart-blue?logo=dart)](https://dart.dev)
6+
[![Kotlin](https://img.shields.io/badge/Kotlin-Native-purple?logo=kotlin)](https://kotlinlang.org)
7+
[![Swift](https://img.shields.io/badge/Swift-Native-orange?logo=swift)](https://developer.apple.com/swift)
68
[![Zero FFmpeg](https://img.shields.io/badge/Zero-FFmpeg-green)](https://github.com/hamas/dart_dlp)
79
[![License](https://img.shields.io/badge/License-MIT-purple)](LICENSE)
810

911
---
1012

1113
## 📖 Introduction
1214

13-
**dart_dlp** is a revolutionary media extraction engine designed to liberate Dart and Flutter developers from the constraints of heavy external binaries. Unlike traditional solutions that wrap `yt-dlp` (Python) or require massive `ffmpeg` bundles, `dart_dlp` is built from the ground up in **100% Pure Dart**.
15+
**dart_dlp** is a revolutionary media extraction engine designed to liberate Dart and Flutter developers from the constraints of heavy external binaries. Unlike traditional solutions that wrap `yt-dlp` (Python) or require massive `ffmpeg` bundles, `dart_dlp` is built from the ground up to be **Lightweight and Invincible**.
1416

15-
It is engineered for **Hyper-Scale** and **Stealth**, capable of navigating complex anti-bot protections, executing rolling cipher decryption natively, and delivering 8K video streams without a single byte of compiled native code.
17+
It combines a **Pure Dart** extraction core with a **Native (Kotlin/Swift)** muxing bridge, delivering 8K video streams without a single byte of compiled FFmpeg or Python code.
1618

17-
### Why dart_dlp?
18-
19-
1. **Zero Dependencies**: No Python, no node.js, no FFMPEG binaries required to *run*.
20-
2. **Native Performance**: Everything happens in the Dart VM.
21-
3. **HamasDownloader™**: A proprietary, multi-threaded chunked downloader that saturates your bandwidth by opening parallel connections.
22-
4. **Stealth Mode**: Rotates between 50+ real-world User-Agents and injects human-like HTTP headers (`Sec-Fetch-*`) to evade IP blocking.
23-
5. **Architecture**: Decoupled design allows you to run this on a server, in a CLI, or embedded directly in a Flutter app.
24-
25-
---
26-
27-
## ✅ Supported Platforms
28-
29-
The engine comes pre-loaded with highly optimized extractors for the "Major 5" social giants, plus generic extendability.
30-
31-
| Platform | Features | Stealth Level |
32-
| :--- | :--- | :--- |
33-
| **YouTube** | 8K/4K/1080p, Rolling Cipher Decryption (JS), Separate Audio/Video Streams | 🛡️ High |
34-
| **TikTok** | Watermark-free Video, JSON Rehydration parsing | 🛡️ Medium |
35-
| **Instagram** | `window._sharedData` parsing, Reels & Posts | 🛡️ High |
36-
| **Facebook** | SD/HD Source Extraction, Regex-based parsing | 🛡️ Medium |
37-
| **X (Twitter)** | `__NEXT_DATA__` Traversal | 🛡️ High |
38-
| **Reddit** | Native JSON API (`.json`) extraction | 🛡️ Low |
39-
| **Pinterest** | `__PWS_DATA__` extraction | 🛡️ Medium |
19+
It is engineered for **Hyper-Scale** and **Stealth**, capable of navigating complex anti-bot protections and executing rolling cipher decryption.
4020

4121
---
4222

43-
## 📦 Installation
44-
45-
Since `dart_dlp` is a premium, high-performance engine, it is distributed via Git to ensure you always have the latest anti-censorship patches.
46-
47-
Add this to your `pubspec.yaml`:
48-
49-
```yaml
50-
dependencies:
51-
dart_dlp:
52-
git:
53-
url: https://github.com/hamas/dart_dlp.git
54-
ref: main
55-
```
56-
57-
Run the installation:
23+
### Why dart_dlp?
5824

59-
```bash
60-
dart pub get
61-
```
25+
1. **Zero External Binaries**: No Python, no node.js.
26+
2. **Native Muxing**: Uses Android's `MediaMuxer` and iOS's `AVAssetExportSession` to merge 4K video+audio instantly (Zero-Encoding).
27+
3. **HamasDownloader™**: A proprietary, multi-threaded chunked downloader that saturates your bandwidth by opening parallel connections.
28+
4. **Stealth Mode**: Rotates between 50+ real-world User-Agents and injects human-like HTTP headers (`Sec-Fetch-*`) to evade IP blocking.
29+
5. **Architecture**: Decoupled design allows for pure Dart usage (extraction only) or full Flutter Plugin power (muxing enabled).
6230

6331
---
6432

65-
## 🛠️ Usage & Architecture
66-
67-
The system is composed of three core pillars: **The Engine**, **The Extractor**, and **The Downloader**.
68-
69-
### 1. The DlpEngine (The Brain)
70-
71-
The `DlpEngine` is the central command dispatcher. It accepts a raw URL, identifies the correct registered extractor, and routes the request.
72-
73-
**Initialization:**
74-
75-
```dart
76-
import 'package:dart_dlp/dart_dlp.dart';
77-
78-
// Create the engine
79-
final engine = DlpEngine();
80-
```
81-
82-
**Stealth Configuration:**
83-
To avoid IP bans when scraping thousands of urls, pass a proxy:
84-
85-
```dart
86-
final engine = DlpEngine(proxy: 'http://user:[email protected]:8080');
87-
// This proxy is automatically propagated to every extractor.
88-
```
89-
90-
### 2. Analysis & Extraction
91-
92-
Calling `extract` returns a `VideoData` object. This object is a normalized representation of the media, regardless of whether it came from YouTube, TikTok, or Reddit.
93-
94-
```dart
95-
try {
96-
final url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
97-
98-
// The engine automatically executes JS decryption if needed
99-
final VideoData video = await engine.extract(url);
100-
101-
print('Title: ${video.title}');
102-
print('Duration: ${video.duration}');
103-
print('Thumbnail: ${video.thumbnail}');
104-
105-
// Inspect available qualities
106-
for (var stream in video.streams) {
107-
print('[${stream.quality}] ${stream.format} - ${stream.url}');
108-
}
109-
} catch (e) {
110-
print('Extraction failed: $e');
111-
}
112-
```
113-
114-
### 3. The HamasDownloader (The Muscle)
33+
## ⚙️ Advanced Features
11534

116-
Standard HTTP requests are slow. `dart_dlp` ships with `HamasDownloader`, a specialized tool that uses **HTTP Range Headers** to download file chunks in parallel.
35+
### ⚡ HD Download & Native Muxing (The "Super" Pattern)
36+
YouTube (and others) often serve 1080p+ video as separate Video and Audio tracks.
37+
`dart_dlp` handles this automatically using its Native Bridge.
11738

118-
```dart
119-
// 1. Select the best stream (e.g., 1080p video)
120-
final stream = video.streams.firstWhere((s) => s.quality == '1080p');
121-
122-
// 2. Initialize Downloader
123-
final downloader = HamasDownloader();
124-
125-
// 3. Start Download
126-
await downloader.download(
127-
stream.url,
128-
'path/to/video.mp4',
129-
onProgress: (DownloadProgress progress) {
130-
// Real-time stats
131-
final percent = (progress.progress * 100).toStringAsFixed(1);
132-
final speed = progress.speedMBps.toStringAsFixed(2);
133-
final eta = progress.etaSeconds;
134-
135-
print('$percent% downloaded | Speed: $speed MB/s | ETA: ${eta}s');
136-
}
137-
);
138-
```
39+
**Zero-FFmpeg Requirement:**
40+
We utilize the device's native APIs (`MediaMuxer` on Android, `AVAssetExportSession` on iOS) to merge streams instantly without re-encoding. This keeps the app size tiny only adding ~20KB to your bundle, compared to FFmpeg's ~50MB.
13941

140-
### 4. DlpController (State Management)
141-
For Flutter apps usage, `DlpController` provides a reactive stream of state changes (`analyzing`, `downloading`, `merging`, `completed`, `error`).
42+
**How it works:**
43+
1. **Detects** if a video is split (e.g., 4K stream).
44+
2. **Downloads** video and audio tracks concurrently.
45+
3. **Invokes** the Native Bridge to merge them in seconds.
46+
4. **Cleans up** temporary files.
14247

14348
```dart
14449
final controller = DlpController();
145-
controller.stateStream.listen((state) {
146-
if (state.status == DlpStatus.downloading) {
147-
print('Downloading... ${state.progress}%');
148-
} else if (state.status == DlpStatus.completed) {
149-
print('Done! File at: ${state.message}');
50+
51+
// Listen to status updates (Extracting -> Downloading -> Merging -> Completed)
52+
controller.state.listen((state) {
53+
print('[${state.status}] ${state.message}');
54+
if (state.status == DlpStatus.merging) {
55+
print('Merging Video & Audio streams...');
15056
}
15157
});
15258
153-
// One-liner execution
154-
controller.process('https://tiktok.com/...', '/downloads/');
155-
```
156-
157-
---
158-
159-
## ⚙️ Advanced Features
160-
161-
### Handling Split Streams (The "NativeMuxer" Pattern)
162-
YouTube (and others) often serve 1080p+ video as separate Video and Audio tracks.
163-
`dart_dlp` detects this automatically.
164-
165-
In **Pure Dart Mode**, the `NativeMuxer` is a no-op interface. The controller will download **both** files and return their paths.
166-
167-
```text
168-
Result:
169-
- video_1080p.mp4 (Video Only)
170-
- audio_128k.m4a (Audio Only)
59+
// Start the Magic (Auto-Muxing included)
60+
final path = await controller.startDownload(videoData, '/storage/emulated/0/Download');
61+
print('Saved to: $path');
17162
```
17263

173-
It is up to your application layer (Server or Client) to invoke `ffmpeg` or `mkvmerge` if you wish to combine them. This keeps `dart_dlp` lightweight and portable.
174-
175-
### Rolling Cipher Decryption
176-
YouTube protects high-value streams with a "Rolling Cipher" in their JavaScript.
177-
`dart_dlp` includes a **JS Execution Engine** (via `flutter_js` or pure Regex parsing) that:
178-
1. Downloads the player JavaScript.
179-
2. Parses the obfuscated decryption functions.
180-
3. Executes the math to solve the signature challenge.
181-
4. Unlocks the 4K stream URL.
182-
183-
All of this happens transparently inside `YouTubeExtractor`.
184-
18564
---
18665

18766
## 🛡️ Stealth Technology
17 Bytes
Binary file not shown.
21.7 KB
Binary file not shown.
27.6 KB
Binary file not shown.
1 Byte
Binary file not shown.
18.1 KB
Binary file not shown.
17 Bytes
Binary file not shown.

android/.gradle/9.2.0/gc.properties

Whitespace-only changes.
17 Bytes
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Fri Jan 30 20:28:44 PKT 2026
2+
gradle.version=9.2.0

0 commit comments

Comments
 (0)