This repository is a Compose Multiplatform-compatible adaptation of the NewPipeExtractor, forked from version v0.24.5
. It is intended for extracting YouTube videos and comments within Kotlin Multiplatform projects.
- Migrated to Kotlin (Multiplatform).
- Based on NewPipeExtractor v0.24.5.
- Internal modules have been refactored and improved for better readability, structure, and platform compatibility.
- Replaced
nanojson
with a pure Kotlin implementation. - Public APIs and function call patterns remain unchanged to ensure compatibility with the original usage.
- 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.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)
ExtractorHelper.getStreamInfo(SERVICE_ID, item.url)
For more details, refer to the sampleApp.
recording.mp4
2025-08-13.181218.mp4
2025-08-13.184911.mp4
β This demo showcases successful audio stream extraction and search suggestions retrieval on both Android and iOS using Kotlin Multiplatform code.
Although the test focused on audio streams for simplicity, the extractor is also capable of handlingvideo streams.(TODO) 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
Serializable
with@Serializable
andkotlinx.serialization
- Remove
nanojson
dependency - Reimplement
nanojson
using 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 migrated to Kotlin
- Code cleanup and module publishing pending
- Add shared
commonTest
cases - Use
runBlocking
and mock data for multiplatform testability - (Optional) Include Compose-based demo or preview usage
- Forked by: @yushosei
- Base version:
NewPipeExtractor v0.24.5
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.