StreamAudio is a robust, high-performance Streamlit web application designed for the deterministic extraction and conversion of audio tracks from YouTube URLs. Utilizing the powerful yt-dlp engine under a modern Python modular architecture, this solution offers reliability and maintainability for high-volume media processing tasks.
This project adheres to the principles of a Modular Monolith, ensuring clear separation between the Presentation Layer (Streamlit UI), Service Layer (Core Logic/yt-dlp wrappers), and Utility Layer (Configuration/Logging). Error handling is deterministic, following the Apex Zero-Defect Mandate.
text StreamAudio-YouTube-Audio-Extractor-Web-App/ βββ src/ β βββ core/ # Business logic, yt-dlp wrappers β βββ services/ β β βββ extractor.py # Primary audio extraction service β βββ ui/ β β βββ app.py # Streamlit Presentation Layer β βββ utils/ β βββ config.py # Configuration management βββ tests/ β βββ unit/ β βββ integration/ βββ .venv/ βββ pyproject.toml # Dependency management (uv) βββ README.md
- π Key Features
- π οΈ Tech Stack (Apex Standard)
- π€ AI Agent Directives
- βοΈ Setup & Development
- π‘ Development Principles
- π License
- Robust Extraction: Leverages
yt-dlpfor best-in-class format detection and downloading. - Streamlit Interface: Provides an intuitive, responsive web GUI for non-CLI users.
- Format Control: Allows specification of desired output audio formats (MP3, M4A, WAV).
- Modular Design: Clear separation of concerns adhering to modern Python best practices.
- CI/CD Ready: Full GitHub Actions pipeline for automated testing and linting.
| Category | Technology | Version Constraint |
|---|---|---|
| Language | Python | 3.10+ |
| Dependency Management | uv | Latest Stable |
| Linting/Formatting | Ruff | Strict Enforcement |
| Testing Framework | Pytest | Comprehensive Coverage |
| Web Framework | Streamlit | Current Stable |
| Media Engine | yt-dlp | Latest Stable |
Click to view Apex Execution Directives for this Repository
Role: You are a Senior Principal Software Architect and Master Technical Copywriter with 40+ years of elite industry experience. You operate with absolute precision, enforcing FAANG-level standards and the wisdom of "Managing the Unmanageable." Context: Current Date is December 2025. You are building for the 2026 standard. Output Standard: Deliver EXECUTION-ONLY results. No plans, no "reporting"βonly executed code, updated docs, and applied fixes. Philosophy: "Zero-Defect, High-Velocity, Future-Proof."
- SPEECH-TO-TEXT INTERPRETATION PROTOCOL:
- Context: User inputs may contain phonetic errors (homophones, typos).
- Semantic Correction: STRICTLY FORBIDDEN from executing literal typos. You must INFER technical intent based on the project context.
- Logic Anchor: Treat the
README.mdas the Single Source of Truth (SSOT).
- MANDATORY MCP INSTRUMENTATION:
- No Guessing: Do not hallucinate APIs. You must use the installed library features (
yt-dlpCLI wrapper logic). - Research First: Use
linkup/braveto search for December 2025 Industry Standards related to video/audio extraction compliance and security. - Validation: Use
docforkto verify every external command signature (e.g.,yt-dlp --extract-audio). - Reasoning: Engage
clear-thought-twoto architect complex media processing flows before writing code, prioritizing thread safety if applicable.
- No Guessing: Do not hallucinate APIs. You must use the installed library features (
Directives: This repository is a Python-based Media Processing Tool.
- PRIMARY SCENARIO: DATA / SCRIPTS / AI (Python)
- Stack: This project leverages Python 3.10+. Key tools include uv (for package management and dependency resolution), Ruff (for ultra-fast linting and formatting), and Pytest (for robust unit and integration testing).
- Architecture: Adheres to a Modular Monolith pattern, ensuring clear separation of concerns for the Streamlit interface and the
yt-dlpservice layer. Prioritize clean API contracts between UI components and the extraction engine. - Dependency Focus: Ensure all interaction with external binaries (
yt-dlp) is encapsulated and idempotent where possible.
| Command Type | Description | Command |
|---|---|---|
| Dependency Setup | Initialize environment and install dependencies | uv sync |
| Formatting/Linting | Run Ruff formatter and linter | ruff check . && ruff format . |
| Unit Testing | Execute all unit tests | pytest tests/unit |
| Full CI Simulation | Run local equivalent of the CI pipeline | uv run build_and_test (See scripts below) |
Apex Verification Strategy: All code changes MUST pass Ruff linting and achieve >90% test coverage on modified logic blocks. Extraction wrappers must handle KeyError and connection timeouts gracefully.
This repository mandates the use of uv for deterministic dependency management.
- Python 3.10 or newer installed.
yt-dlpbinary installed globally, or configured to be downloaded by the script (Preferred: Ensure installation viauv syncif packaged as a dependency).
bash
git clone https://github.com/chirag127/StreamAudio-YouTube-Audio-Extractor-Web-App.git cd StreamAudio-YouTube-Audio-Extractor-Web-App
uv sync
| Script Name | Command | Purpose |
|---|---|---|
start-web |
uv run start-web |
Launches the Streamlit application |
test-all |
uv run test-all |
Runs linting, formatting, and all Pytest suites |
check-deps |
uv check |
Verifies the dependency graph |
All development within this repository must strictly adhere to the following architectural tenets:
- SOLID: Especially Single Responsibility (ensuring extraction logic is separate from UI rendering).
- DRY: Avoid duplication, particularly in configuration loading or error message generation.
- YAGNI: Implement only the functionality required for robust audio extraction; avoid speculative complexity.
- Future-Proofing: Use Python 3.10+ features where they improve clarity and performance (e.g., structural pattern matching, if applicable to logic flow).
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. See the LICENSE file for details.