ytui-media 0.1.0__tar.gz

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.
Files changed (38) hide show
  1. ytui_media-0.1.0/LICENSE +21 -0
  2. ytui_media-0.1.0/PKG-INFO +427 -0
  3. ytui_media-0.1.0/README.md +387 -0
  4. ytui_media-0.1.0/app.py +364 -0
  5. ytui_media-0.1.0/config.py +232 -0
  6. ytui_media-0.1.0/ffmpeg_utils.py +342 -0
  7. ytui_media-0.1.0/history.py +145 -0
  8. ytui_media-0.1.0/manager.py +681 -0
  9. ytui_media-0.1.0/pyproject.toml +81 -0
  10. ytui_media-0.1.0/rtl_utils.py +110 -0
  11. ytui_media-0.1.0/screens/__init__.py +21 -0
  12. ytui_media-0.1.0/screens/download_screen.py +582 -0
  13. ytui_media-0.1.0/screens/ffmpeg_modal.py +296 -0
  14. ytui_media-0.1.0/screens/format_screen.py +502 -0
  15. ytui_media-0.1.0/screens/help_screen.py +1 -0
  16. ytui_media-0.1.0/screens/history_screen.py +361 -0
  17. ytui_media-0.1.0/screens/playlist_screen.py +603 -0
  18. ytui_media-0.1.0/screens/search_screen.py +362 -0
  19. ytui_media-0.1.0/screens/settings_screen.py +747 -0
  20. ytui_media-0.1.0/setup.cfg +4 -0
  21. ytui_media-0.1.0/tests/test_config.py +137 -0
  22. ytui_media-0.1.0/tests/test_engine.py +409 -0
  23. ytui_media-0.1.0/tests/test_ffmpeg.py +134 -0
  24. ytui_media-0.1.0/tests/test_history.py +141 -0
  25. ytui_media-0.1.0/tests/test_manager.py +349 -0
  26. ytui_media-0.1.0/tests/test_rtl.py +225 -0
  27. ytui_media-0.1.0/tests/test_tui.py +981 -0
  28. ytui_media-0.1.0/themes.py +440 -0
  29. ytui_media-0.1.0/widgets/__init__.py +1 -0
  30. ytui_media-0.1.0/widgets/format_column.py +152 -0
  31. ytui_media-0.1.0/widgets/progress_card.py +77 -0
  32. ytui_media-0.1.0/ytdlp_engine.py +1132 -0
  33. ytui_media-0.1.0/ytui_media.egg-info/PKG-INFO +427 -0
  34. ytui_media-0.1.0/ytui_media.egg-info/SOURCES.txt +36 -0
  35. ytui_media-0.1.0/ytui_media.egg-info/dependency_links.txt +1 -0
  36. ytui_media-0.1.0/ytui_media.egg-info/entry_points.txt +3 -0
  37. ytui_media-0.1.0/ytui_media.egg-info/requires.txt +13 -0
  38. ytui_media-0.1.0/ytui_media.egg-info/top_level.txt +10 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,427 @@
1
+ Metadata-Version: 2.4
2
+ Name: ytui-media
3
+ Version: 0.1.0
4
+ Summary: A sleek, keyboard-driven Terminal User Interface (TUI) client and download manager for yt-dlp
5
+ Author: bkallash
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/bkallash/YTUI
8
+ Project-URL: Repository, https://github.com/bkallash/YTUI
9
+ Project-URL: Issues, https://github.com/bkallash/YTUI/issues
10
+ Keywords: yt-dlp,tui,terminal,textual,youtube,video-downloader,media-downloader,rich
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Multimedia :: Video
22
+ Classifier: Topic :: Terminals
23
+ Classifier: Topic :: Utilities
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: textual>=0.80.0
28
+ Requires-Dist: rich>=13.0.0
29
+ Requires-Dist: yt-dlp>=2024.0.0
30
+ Requires-Dist: mutagen>=1.47.0
31
+ Requires-Dist: arabic-reshaper>=3.0.0
32
+ Requires-Dist: python-bidi>=0.4.2
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
35
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
36
+ Requires-Dist: build>=1.0.0; extra == "dev"
37
+ Requires-Dist: twine>=5.0.0; extra == "dev"
38
+ Requires-Dist: pyinstaller>=6.0.0; extra == "dev"
39
+ Dynamic: license-file
40
+
41
+ <div align="center">
42
+
43
+ # โšก YTUI
44
+
45
+ **A sleek, keyboard-driven, high-density Terminal User Interface (TUI) client and download manager for [yt-dlp](https://github.com/yt-dlp/yt-dlp).**
46
+
47
+ [![Python Version](https://img.shields.io/badge/python-3.10+-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org/)
48
+ [![Textual](https://img.shields.io/badge/built%20with-Textual-00D2FF.svg?style=flat)](https://textual.textualize.io/)
49
+ [![Rich](https://img.shields.io/badge/styled%20with-Rich-FF4B4B.svg?style=flat)](https://rich.readthedocs.io/)
50
+ [![yt-dlp](https://img.shields.io/badge/powered%20by-yt--dlp-FF0000.svg?style=flat&logo=youtube&logoColor=white)](https://github.com/yt-dlp/yt-dlp)
51
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat)](https://opensource.org/licenses/MIT)
52
+ [![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg?style=flat)]()
53
+
54
+ <br/>
55
+
56
+ [![Download Standalone Executable](https://img.shields.io/badge/โฌ‡๏ธ%20DOWNLOAD-yt--dlp--tui.exe%20(Windows%20x64)-2ea44f?style=for-the-badge&logo=windows&logoColor=white)](https://github.com/bkallash/YTUI/raw/main/dist/yt-dlp-tui.exe)
57
+
58
+ </div>
59
+
60
+ ---
61
+
62
+ ## ๐Ÿ“– Overview
63
+
64
+
65
+ **YTUI** brings the unmatched downloading power of `yt-dlp` and `FFmpeg` into a modern, interactive terminal interface built with **Python**, **Textual**, and **Rich**.
66
+
67
+ No more memorizing complex CLI flags or wrestling with stream formats:
68
+ - ๐ŸŽฏ **Visual Stream Selector**: Pick exact video (4K, 2K, 1080p...) and audio (320k, 256k, 192k...) streams side-by-side.
69
+ - โšก **Background Queue Manager**: Track active downloads with live speed, ETA, progress bars, and stdout logs.
70
+ - ๐Ÿ“‘ **Playlist Configurator**: Select, deselect, or invert tracks with live size and duration estimations.
71
+ - ๐Ÿท๏ธ **Rich Media Embedding**: Embed subtitles, high-res thumbnails/cover art, artist/album metadata tags, and video chapter markers directly into your files.
72
+ - ๐Ÿ›ก๏ธ **Network Auto-Resume**: Automatically recovers interrupted downloads from exact byte offsets.
73
+ - ๐ŸŽจ **17 Handcrafted Themes**: Tailored dark and light themes (Shadcn Zinc, Tokyo Night, Catppuccin, Dracula, Nord, OLED Black, and more).
74
+ - ๐ŸŒ **Native RTL Text Engine**: Clean rendering for Arabic, Hebrew, Persian, and Urdu metadata without character corruption.
75
+
76
+ ---
77
+
78
+ ## โœจ Key Features
79
+
80
+ ### ๐Ÿ” Multi-Platform Search & URL Extraction
81
+ - **1,000+ Supported Sites**: Works seamlessly with YouTube, X/Twitter, TikTok, Twitch, SoundCloud, Vimeo, Reddit, Bilibili, Facebook, Instagram, and more.
82
+ - **Direct Search**: Search YouTube directly by typing search terms (`ytsearch`) without opening a browser.
83
+ - **Interactive Results**: View title, uploader, duration, view counts, and upload dates before downloading.
84
+
85
+ ### ๐ŸŽ›๏ธ Dual-Column Side-by-Side Stream Matrix
86
+
87
+ <p align="center">
88
+ <img src="assets/format_screen.svg" alt="Format Selection Matrix" width="100%"/>
89
+ </p>
90
+
91
+ - **Independent Stream Pairing**:
92
+ - **Left Column (Video)**: Choose 4K, 2K, 1080p, 720p, 480p, 360p, or **`๐Ÿšซ No Video (Audio Only)`**.
93
+ - **Right Column (Audio)**: Choose 320 kbps, 256 kbps, 192 kbps, 128 kbps, 64 kbps, or **`๐Ÿ”‡ No Audio (Video Only)`**.
94
+ - **Container Flexibility**: Select target containers (`MP4`, `MKV`, `WEBM`, `MP3`, `M4A`, `FLAC`, `OPUS`, `WAV`, `AAC`).
95
+ - **1-Click Presets**:
96
+ - `1` : **โญ Best Quality** (Best available video + best audio)
97
+ - `2` : **๐ŸŽฌ 1080p FHD** (Crisp Full HD standard)
98
+ - `3` : **๐Ÿ“ฆ Smallest Size** (Storage-efficient resolution)
99
+ - `4` : **๐ŸŽต Audio Only MP3** (Extracted high-bitrate music)
100
+
101
+ ### ๐Ÿ“‘ Interactive Playlist & Batch Downloader
102
+ - **Track Selection Dialog**: Interactive checkboxes to pick specific videos from albums, playlists, or channels.
103
+ - **Batch Tools**: `Select All` (`Ctrl+A`), `Deselect All` (`Ctrl+D`), and `Invert Selection` (`I`).
104
+ - **Dynamic Estimations**: Live calculation of total selected tracks, combined runtime, and estimated download size.
105
+
106
+ ### ๐Ÿ“ฅ Multi-Worker Queue & Download Manager (`Ctrl+J`)
107
+
108
+ <p align="center">
109
+ <img src="assets/download_screen.svg" alt="Download Queue Manager" width="100%"/>
110
+ </p>
111
+
112
+ - **Concurrent Workers**: Download multiple tasks simultaneously in the background.
113
+ - **Live Statistics**: Real-time download speed, percentage, transferred bytes, and estimated completion time (ETA).
114
+ - **Task Controls**: Pause (`P`), Resume / Retry (`R`), Edit Format (`E`), Cancel (`C`), Delete (`D`), and Clear Completed (`X`).
115
+ - **Real-Time Logs**: Press `L` to toggle the live yt-dlp stdout log stream for deep diagnostics.
116
+ - **Quick File Launch**: Open downloaded files in your default media player (`O` / `Enter`) or reveal the destination directory in File Explorer (`F`).
117
+
118
+ ### ๐Ÿ“š Download History & Library (`Ctrl+Y`)
119
+ - **Persistent Media Archive**: Automatically logs every completed download with title, format, file size, download timestamp, and destination path.
120
+ - **Instant Search & Filter**: Press `/` or `Ctrl+F` for real-time, case-insensitive searching across your entire library.
121
+ - **1-Click Management**: Launch files in your default media player (`Enter` / `O`), reveal in File Explorer (`F`), re-download with updated formats (`R`), or delete entries (`D`).
122
+ - **Atomic Persistence**: Thread-safe, corruption-resistant storage keeping your library safe across app restarts.
123
+
124
+ ### ๐Ÿ›ก๏ธ Network Resiliency & Smart Auto-Resume
125
+ - **Byte-Offset Resumption**: Partial `.part` files are automatically resumed from where they stopped (`continuedl: True`).
126
+ - **Connection Drop Recovery**: Automatic exponential retry backoff (up to 10 retries by default) for unstable networks.
127
+ - **HTTP 403 Forbidden Auto-Fallback**: Automatically retries with embedded web clients if YouTube throttles format downloads.
128
+
129
+ ### ๐Ÿช Authentication & Cookies Suite
130
+ - **Browser Extraction**: One-click session cookie extraction for Google Chrome, Mozilla Firefox, Microsoft Edge, Brave, Opera, Vivaldi, and Apple Safari.
131
+ - **Custom `cookies.txt` Support**: Fully compatible with exported Netscape format cookies for age-restricted and member-only videos.
132
+ - **Built-in Auth Tester**: Test your cookie file directly inside the Settings screen to verify active login sessions.
133
+
134
+ ### โœ‚๏ธ SponsorBlock, Embeddings & Media Post-Processing
135
+ - **Embed Subtitles**: Download and hard-embed or soft-embed subtitles directly into video streams (`MP4`, `MKV`, `WEBM`) with multi-language selection and AI/auto-generated caption support, or export as standalone `.srt` files.
136
+ - **Embed Thumbnails & Artwork**: Embed high-resolution video thumbnails and cover art directly into media files (`MP4`, `MKV`, `MP3`, `M4A`, `FLAC`, etc.) with native Mutagen integration.
137
+ - **Embed Artist & Metadata**: Automatically tag downloads with Artist, Title, Album, Channel/Uploader, and Year/Release Date metadata for a clean music and video library.
138
+ - **Embed Chapter Markers & Splitting**: Embed chapter markers directly into containers for instant chapter navigation in players (VLC, mpv, etc.), or split long videos into separate per-chapter tracks (`--split-chapters`).
139
+ - **SponsorBlock Integration**: Automatically detect and remove community-reported sponsored segments, self-promotions, intros, and outros from media files.
140
+
141
+ ### ๐ŸŽจ 17 Handcrafted Themes & Settings (`Ctrl+O`)
142
+
143
+ <p align="center">
144
+ <img src="assets/settings_screen.svg" alt="Settings & Appearance Configuration" width="100%"/>
145
+ </p>
146
+
147
+ Switch between modern terminal aesthetics via **`Ctrl+O`** โ†’ **Appearance**:
148
+ - **Dark Profiles**: `Shadcn Zinc`, `Tokyo Night`, `Catppuccin Mocha`, `Dracula Pro`, `Nord Polar`, `Gruvbox Dark`, `Monokai Pro`, `Cyberpunk Neon`, `Midnight Amethyst`, `Matrix Emerald`, `Rosรฉ Pine`, `Solarized Dark`, `Synthwave '84`, `OLED Jet Black`.
149
+ - **Light Profiles**: `Catppuccin Latte`, `Solarized Light`, `Titanium Light`.
150
+
151
+ ### ๐ŸŒ Arabic & RTL Text Engine
152
+ - First-class support for Right-to-Left (RTL) languages including Arabic, Hebrew, Persian, and Urdu.
153
+ - Resolves broken disconnected characters and reversed terminal text with automatic glyph shaping and Unicode BiDi algorithm.
154
+ - Multiple selectable modes: `Reshaped + BiDi`, `Native Terminal RTL`, `BiDi Order Only`, or `Disabled`.
155
+
156
+ ---
157
+
158
+ ## ๐Ÿš€ Setup & Installation
159
+
160
+ ### Option A: Install via PyPI / pipx (Recommended for Terminal Users)
161
+
162
+ You can install and run YTUI in an isolated terminal environment with `pipx` or standard `pip`:
163
+
164
+ ```bash
165
+ # Using pipx (recommended)
166
+ pipx install ytui-media
167
+
168
+ # Or using pip
169
+ pip install ytui-media
170
+ ```
171
+
172
+ Then simply launch from any directory:
173
+ ```bash
174
+ ytui
175
+ # or
176
+ yt-dlp-tui
177
+ ```
178
+
179
+ ---
180
+
181
+ ### Option B: Standalone Executable (No Python Required)
182
+
183
+ [![Download yt-dlp-tui.exe](https://img.shields.io/badge/โฌ‡๏ธ_Download-yt--dlp--tui.exe-2ea44f?style=for-the-badge&logo=windows&logoColor=white)](https://github.com/bkallash/YTUI/raw/main/dist/yt-dlp-tui.exe)
184
+
185
+ 1. **Download**: Click the download button above or get [`dist/yt-dlp-tui.exe`](dist/yt-dlp-tui.exe).
186
+ 2. **FFmpeg Setup**: On first launch, the app will automatically prompt to download and configure FFmpeg in 1 click if not found on your system.
187
+ 3. **Launch**: Double-click `yt-dlp-tui.exe` to run immediately.
188
+
189
+ ---
190
+
191
+ ### Option C: Run from Source (Python 3.10+)
192
+
193
+ #### 1. Prerequisites
194
+ - **Python 3.10 or higher**: Verify with `python --version`.
195
+ - **FFmpeg**:
196
+ - **Windows**: `winget install Gyan.FFmpeg` or `scoop install ffmpeg` / `choco install ffmpeg`
197
+ - **macOS**: `brew install ffmpeg`
198
+ - **Linux**: `sudo apt install ffmpeg` / `sudo pacman -S ffmpeg` / `sudo dnf install ffmpeg`
199
+
200
+ #### 2. Clone & Install Dependencies
201
+ ```bash
202
+ # Clone the repository
203
+ git clone https://github.com/bkallash/YTUI.git
204
+ cd YTUI
205
+
206
+ # Create and activate a virtual environment (recommended)
207
+ python -m venv .venv
208
+
209
+ # On Windows:
210
+ .venv\Scripts\activate
211
+
212
+ # On Linux / macOS:
213
+ source .venv/bin/activate
214
+
215
+ # Install required Python packages
216
+ pip install -r requirements.txt
217
+ ```
218
+
219
+ #### 3. Launch the Application
220
+ ```bash
221
+ python app.py
222
+ ```
223
+
224
+ **On Windows**, you can also double-click or run:
225
+ ```cmd
226
+ .\tui.bat
227
+ ```
228
+
229
+
230
+ ---
231
+
232
+ ## โŒจ๏ธ Keyboard Shortcuts Cheat Sheet
233
+
234
+ ### ๐ŸŒ Global Navigation
235
+ | Shortcut | Action |
236
+ | :--- | :--- |
237
+ | **`Ctrl+S`** | Switch to **Search & URL Input** screen |
238
+ | **`Ctrl+J`** | Switch to **Download Queue Manager** screen |
239
+ | **`Ctrl+Y`** | Switch to **Download History & Library** screen |
240
+ | **`Ctrl+O`** | Switch to **Settings & Configuration** screen |
241
+ | **`Ctrl+Q`** | Graceful exit (saves config and stops active workers) |
242
+
243
+ ---
244
+
245
+ ### ๐Ÿ” Search Screen
246
+ | Shortcut | Action |
247
+ | :--- | :--- |
248
+ | **`Enter`** (in input) | Start extraction / YouTube search |
249
+ | **`Up` / `Down`** | Navigate search results table |
250
+ | **`Enter`** (on row) | Select video and open format selector |
251
+ | **`Esc`** | Clear input / Return to previous state |
252
+
253
+ ---
254
+
255
+ ### ๐ŸŽ›๏ธ Stream & Format Selector
256
+ | Shortcut | Action |
257
+ | :--- | :--- |
258
+ | **`Left` / `Right`** (`h`/`l`) | Switch focus between Video and Audio columns |
259
+ | **`Up` / `Down`** (`j`/`k`) | Navigate available format streams in active column |
260
+ | **`1` / `2` / `3` / `4`** | Select Preset: `1` Best, `2` 1080p, `3` Smallest, `4` Audio Only |
261
+ | **`C`** | Cycle target container format (`MP4`, `MKV`, `WEBM`, etc.) |
262
+ | **`Q`** | Cycle audio bitrate quality (`320k`, `256k`, `192k`, `128k`, `V0`) |
263
+ | **`Enter` / `D`** | Start download immediately and switch to Queue |
264
+ | **`A`** | Add task to Queue in background without leaving screen |
265
+ | **`Esc`** | Return to Search screen |
266
+
267
+ ---
268
+
269
+ ### ๐Ÿ“‘ Playlist Configurator
270
+ | Shortcut | Action |
271
+ | :--- | :--- |
272
+ | **`Space`** | Toggle inclusion checkbox for selected track |
273
+ | **`Ctrl+A`** | Select all tracks |
274
+ | **`Ctrl+D`** | Deselect all tracks |
275
+ | **`I`** | Invert selection |
276
+ | **`Left` / `Right`** | Switch focus between Tracks list and Format selector |
277
+ | **`Enter` / `D`** | Queue all selected tracks for download |
278
+ | **`Esc`** | Cancel and return to search |
279
+
280
+ ---
281
+
282
+ ### ๐Ÿ“ฅ Download Queue Manager (`Ctrl+J`)
283
+ | Shortcut | Action |
284
+ | :--- | :--- |
285
+ | **`P`** | Pause selected download |
286
+ | **`R`** | Resume / Retry selected download |
287
+ | **`E`** | Edit format for selected task |
288
+ | **`C`** | Cancel active download |
289
+ | **`D` / `Delete`** | Delete task from queue |
290
+ | **`L`** | Toggle live stdout logs drawer |
291
+ | **`O` / `Enter`** | Open completed media file in default system player |
292
+ | **`F`** | Open destination folder in File Explorer / Finder |
293
+ | **`X`** | Clear all finished and cancelled tasks |
294
+
295
+ ---
296
+
297
+ ### ๐Ÿ“š Download History (`Ctrl+Y`)
298
+ | Shortcut | Action |
299
+ | :--- | :--- |
300
+ | **`/`** or **`Ctrl+F`** | Focus real-time filter input |
301
+ | **`Enter` / `O`** | Open media file in default player |
302
+ | **`F`** | Reveal file in Explorer / Finder |
303
+ | **`R`** | Re-download URL with format selector |
304
+ | **`D`** | Remove record from history |
305
+ | **`C`** | Clear entire download history |
306
+
307
+ ---
308
+
309
+ ### โš™๏ธ Settings Screen (`Ctrl+O`)
310
+ | Shortcut | Action |
311
+ | :--- | :--- |
312
+ | **`Up` / `Down`** | Navigate settings categories sidebar |
313
+ | **`Tab` / `Shift+Tab`** | Move focus between fields |
314
+ | **`Left` / `Right`** | Cycle dropdown / selector values |
315
+ | **`Ctrl+S`** | Save configuration |
316
+ | **`Ctrl+R`** | Reset configuration to default values |
317
+ | **`Ctrl+U`** | Self-update yt-dlp to latest upstream version |
318
+ | **`Esc`** | Discard unsaved changes and go back |
319
+
320
+ ---
321
+
322
+ ## ๐Ÿช Cookies & Authentication (Windows / YouTube Guide)
323
+
324
+ For age-restricted, private, or subscriber-only videos, YouTube requires active account cookies.
325
+
326
+ ### Why Direct Chrome Extraction Fails on Windows
327
+ 1. **SQLite Database File Lock**: When Google Chrome is running on Windows, it holds an exclusive lock on its cookie database (`Network/Cookies`), preventing other applications from reading it.
328
+ 2. **App-Bound Encryption (Chrome 127+)**: Recent versions of Chrome encrypt stored credentials with Windows App-Bound Encryption, blocking third-party process access.
329
+
330
+ ### Recommended 100% Reliable Fix (`cookies.txt`):
331
+ 1. Install an extension like **[Get cookies.txt LOCALLY](https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc)** in Chrome or Firefox.
332
+ 2. Open YouTube, click the extension icon, and click **Export**.
333
+ 3. In **YTUI**, press **`Ctrl+O`** โ†’ **`Cookies & Auth`**.
334
+ 4. Set **Browser Cookies** to `None (No Cookies)` and paste your file path into **`Custom Cookies.txt Path`** (e.g. `C:\Users\username\Downloads\youtube.com_cookies.txt`).
335
+ 5. Click **`โ–ถ Test Cookie Setup & Auth`** to verify login detection.
336
+
337
+ ---
338
+
339
+ ## โš™๏ธ Configuration
340
+
341
+ Configuration is automatically persisted to:
342
+ - **Windows**: `%APPDATA%\ytui\config.json`
343
+ - **Linux / macOS**: `~/.config/ytui/config.json`
344
+
345
+ ### Sample `config.json`:
346
+ ```json
347
+ {
348
+ "download_dir": "C:\\Users\\user\\Downloads",
349
+ "filename_template": "%(title)s [%(id)s].%(ext)s",
350
+ "max_concurrent_downloads": 3,
351
+ "rate_limit": "0",
352
+ "retries": 10,
353
+ "continuedl": true,
354
+ "browser_cookies": "none",
355
+ "cookies_file": "",
356
+ "download_subtitles": false,
357
+ "auto_generated_subtitles": false,
358
+ "subtitle_mode": "embed",
359
+ "subtitle_langs": "en",
360
+ "download_thumbnail": false,
361
+ "thumbnail_mode": "embed",
362
+ "embed_chapters": false,
363
+ "split_chapters": false,
364
+ "remove_sponsor_segments": false,
365
+ "sponsorblock_categories": "sponsor,selfpromo",
366
+ "embed_metadata": true,
367
+ "proxy": "",
368
+ "geo_bypass": true,
369
+ "theme": "shadcn-zinc",
370
+ "rtl_mode": "reshaped_bidi"
371
+ }
372
+ ```
373
+
374
+ ---
375
+
376
+ ## ๐Ÿ“ฆ Building Standalone Executable (.exe)
377
+
378
+ You can package the entire application into a standalone Windows binary without requiring Python to be installed on target machines:
379
+
380
+ ### Option 1: One-Click Build Script (Windows)
381
+ ```cmd
382
+ .\build.bat
383
+ ```
384
+
385
+ ### Option 2: Command Line
386
+ ```bash
387
+ pip install -r requirements.txt
388
+ pyinstaller --noconfirm --clean yt-dlp-tui.spec
389
+ ```
390
+
391
+ The resulting standalone executable will be exported to:
392
+ ```
393
+ dist/yt-dlp-tui.exe
394
+ ```
395
+
396
+ ---
397
+
398
+ ## ๐Ÿงช Running Tests
399
+
400
+
401
+ The test suite covers configuration management, yt-dlp format extraction, download queue management, Arabic/RTL text rendering, and asynchronous Textual UI screens:
402
+
403
+ ```bash
404
+ python -m pytest tests/ -v
405
+ ```
406
+
407
+ ---
408
+
409
+ ## ๐Ÿ› ๏ธ Built With
410
+
411
+ - **[Textual](https://textual.textualize.io/)**: Modern async TUI application framework for Python.
412
+ - **[Rich](https://rich.readthedocs.io/)**: Terminal formatting, tables, styled markup, and rendering.
413
+ - **[yt-dlp](https://github.com/yt-dlp/yt-dlp)**: Feature-rich command-line audio/video downloader.
414
+ - **[arabic-reshaper](https://github.com/mpcabd/python-arabic-reshaper)** & **[python-bidi](https://github.com/MeirKriheli/python-bidi)**: Advanced Right-to-Left (RTL) text shaping.
415
+ - **[mutagen](https://github.com/quodlibet/mutagen)**: Native audio & video tag and artwork embedding.
416
+
417
+ ---
418
+
419
+ ## ๐Ÿ“„ License
420
+
421
+ This project is licensed under the **MIT License** โ€” see the [LICENSE](LICENSE) file for details.
422
+
423
+ ---
424
+
425
+ <div align="center">
426
+ <sub>Built with โค๏ธ for terminal power users. Star โญ this repository if you find it useful!</sub>
427
+ </div>