$ show HydeYYHH/Litube
Litube is an advanced Android WebView wrapper for YouTube, providing ad-free playback, native video/audio downloading, background play, Picture-in-Picture (PiP), SponsorBlock integration, and a customizable extension system. It uses a hybrid architecture where YouTube's mobile site is rendered in a WebView via `YoutubeFragment`, while video playback is handled natively using AndroidX Media3 (ExoPlayer) with custom `YoutubeHttpDataSource` for streaming. The app includes a full-featured download manager (multi-threaded chunked downloads, audio/video merging with MP4Parser), a queue system, a mini-player, and gesture controls. It reverse-engineers YouTube's streaming protocols using the NewPipe Extractor and generates PoTokens through a WebView-based mechanism to bypass bot detection. The application is structured as a single-module Gradle project with Dagger Hilt for dependency injection, MMKV for key-value storage, and Gson for serialization. It has extensive JavaScript injection (`init.js`) to manipulate the YouTube DOM for features like hiding Shorts, displaying dislikes, and injecting a custom settings page. While primarily an application, it includes data extraction components (stream catalog, delivery analysis) that could be considered a research layer for understanding YouTube's streaming infrastructure.
The LLM identified 4 files worth highlighting for reuse:
Merges separate audio and video streams into a single MP4 file using the mp4parser library. Demonstrates a clean, self-contained media muxing utility that can be extracted for any Android project needing to combine downloaded streams into a playable file.
Multi-threaded chunked download implementation with progress reporting, pause/resume support, and integration with a download service. The class is well-isolated and could be reused as a generic file download engine for Android applications.
Custom Media3 `BaseDataSource` that handles YouTube-specific HTTP requirements (gzip, cookie injection, custom headers). Demonstrates how to extend ExoPlayer's data source layer for a proprietary streaming service, and can serve as a reference for building similar adapters.
Custom `View` that overlays sponsor segment indicators on the player's progress bar, handling touch events for segment skipping and highlighting. This reusable component can be adapted for any video player that needs to display and interact with time-based overlays.