This repository is a Compose Multiplatform-compatible adaptation of the NewPipeExtractor. The migration started from v0.24.5 and includes selected service-compatibility fixes from newer upstream versions. It is intended for extracting YouTube and SoundCloud content within Kotlin Multiplatform projects.
- Migrated to Kotlin (Multiplatform).
- Migration base: NewPipeExtractor v0.24.5, with targeted current-service compatibility fixes.
- Internal modules have been refactored and improved for better readability, structure, and platform compatibility.
- Replaced
nanojsonwith a pure Kotlin implementation. - Public APIs and function call patterns remain unchanged to ensure compatibility with the original usage.
- β Audio stream extraction supports both YouTube and SoundCloud.
- β YouTube progressive and video-only stream extraction is available.
- This project aims to serve as a foundation for integrating content extraction logic into Compose Multiplatform applications.
implementation("io.github.yushosei:newpipe-extractor-kmp:1.3.0")NewPipe.init(DefaultDownloaderImpl.initDefault())ExtractorHelper.searchFor(
SERVICE_ID, searchText, listOf("videos"),
"",
)ExtractorHelper.getMoreSearchItems(
SERVICE_ID, searchText, listOf("videos"), "", page
)ExtractorHelper.suggestionsFor(SERVICE_ID, searchText)val info = ExtractorHelper.getStreamInfo(SERVICE_ID, item.url)
val audioStreams = info.audioStreams
val progressiveVideoStreams = info.videoStreams // video + audio
val adaptiveVideoStreams = info.videoOnlyStreams // pair with an audio streamFor more details, refer to the sampleApp.
recording.mp4
2025-08-13.181218.mp4
2025-08-13.184911.mp4
β The sample supports audio and video playback modes. YouTube uses progressive video streams with embedded audio, while SoundCloud remains audio-only. Platform video surfaces are implemented for Android (Media3), iOS (AVPlayer), desktop (VLCJ), and Wasm (HTML video). All core logic is written in pure Kotlin, making it platform-independent and theoretically usable across desktop and web environments too.
The current implementation has been verified on Android and iOS targets using Compose Multiplatform UI.
π¦ We plan to release a cleaned-up and library-ready version of the module in the near future to facilitate reuse and integration !
This project includes a reimplementation of nanojson in pure Kotlin, rewritten from scratch to work within the Kotlin Multiplatform (NewPipeExtractor).
- β The implementation has been tested in conjunction with NewPipe and verified to extract data correctly.
- β However, this Kotlin version of nanojson is an interim solution. It was built for functional compatibility and does not guarantee performance parity with the original Java version.
- It exists only to enable current operation and may be replaced in the future with a more robust or performant JSON parser tailored for KMP.
- Remove core Java-only APIs (e.g.
Serializable,Optional,Pattern,URL,Objects) - Replace Java collections, streams, and IO with Kotlin equivalents
- Decide on Rhino integration approach (e.g. maintain, isolate, or replace)
- Convert Java utility classes (
Pair,ManifestCache, etc.) to idiomatic Kotlin
- Replace
Serializablewith@Serializableandkotlinx.serialization
- Remove
nanojsondependency - Reimplement
nanojsonusing pure Kotlin logic - Evaluate long-term direction for JSON handling:
- Convert to a pure Kotlin @Serializable-based structure
- More faithfully replicate original nanojson behavior for performance and features
Core functionality has been migrated but not yet fully cleaned or published.
- Search functionality migrated to Kotlin
- Search suggestion handling migrated to Kotlin
- Stream extraction (YouTube video info) migrated to Kotlin
- Audio stream extraction (YouTube, SoundCloud) migrated to Kotlin
- Progressive and video-only stream extraction (YouTube) migrated to Kotlin
- Compose Multiplatform sample video playback surfaces
- Code cleanup and module publishing pending
- Add shared
commonTestcases - Use
runBlockingand mock data for multiplatform testability - Include a Compose Multiplatform audio/video demo
Run deterministic tests with:
./gradlew :newpipe-KMP:desktopTestRun opt-in live service smoke tests with:
./gradlew :newpipe-KMP:desktopTest -Dnewpipe.liveTests=true- Forked by: @yushosei
- Migration base:
NewPipeExtractor v0.24.5 - Library version:
1.3.0
This project is licensed under the GNU General Public License v3 or (at your option) any later version.
- New files and contributions in this repository are Β© 2025 @yushosei.
- All original content from the forked NewPipeExtractor remains Β© the NewPipe Team.