Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / youpipe / extractor / AGENTS.md
| 1 | # AGENTS.md — youpipe/extractor/ (':youpipe:extractor') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `youpipe/extractor/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | _Install: ./install youpipe (dev by default)._ |
| 6 | <!-- last-reviewed: 2026-10-16 --> |
| 7 | - Gradle: :youpipe:extractor / dir: youpipe/extractor/ |
| 8 | - Package roots present: org.schabi.newpipe.extractor (upstream NewPipe API, not the closed set — third-party fork) |
| 9 | - Entry files: NewPipe.kt (`init` + service registry) |
| 10 | - Deps: protobuf-javalite, brotli-dec, jsr305 (no Modern-Apps modules) |
| 11 | - Metadata: absent (libraries none by design) |
| 12 | - Rust: no / screenshotTest: no |
| 13 | |
| 14 | ## Overview |
| 15 | **Purpose:** Pure-JVM YouTube/service extraction library — the NewPipe extractor fork that `:youpipe` uses to resolve streams, channels, playlists, search, and comments without the official API. |
| 16 | **Key features:** |
| 17 | - Per-service extractors (YouTube plus other services under `services/`) for streams, channels, playlists, search, suggestions, kiosks, and comments |
| 18 | - Localisation/time-ago parsing and pagination (`Page`, `ListExtractor`, `InfoItemsCollector`) for feed-style crawling |
| 19 | - Downloader abstraction — the host app injects its HTTP stack via `NewPipe.init(downloader)` |
| 20 | **Architecture / data-flow:** Host calls `NewPipe.init(downloader, localization)` once, resolves a `StreamingService` from `ServiceList`, then pulls typed `Info`/`ListInfo` objects through `Extractor` subclasses per entity; YouTube session PO-tokens plug in via `YoutubeSessionPoTokenProvider`. No Android, no Room, no network of its own — protobuf schemas under `src/main/proto` feed the YouTube player-response parsing. |
| 21 | **Entry points + reading order:** `NewPipe.kt` (`init`, `getService`) → `StreamingService.kt` → `Extractor.kt` / `ListExtractor.kt` → `services/youtube/` extractors → `downloader/Downloader.kt`. |
| 22 | **Gotchas:** |
| 23 | - This is a vendored upstream fork — prefer minimal surgical patches; large refactors will collide with upstream merges |
| 24 | - The old card was an empty stub (no roots, entries, or deps listed); all header fields are new from this rewrite |
| 25 | - Protobuf `lite` java builtin must stay `named("java")`, not `create` — the JVM path pre-registers it and a second create fails the build |
| 26 | |
| 27 | ## Key files |
| 28 | ### Root — registry + base types |
| 29 | - org/schabi/newpipe/extractor/NewPipe.kt — init + service registry |
| 30 | - org/schabi/newpipe/extractor/ServiceList.kt |
| 31 | - org/schabi/newpipe/extractor/StreamingService.kt |
| 32 | - org/schabi/newpipe/extractor/Extractor.kt |
| 33 | - org/schabi/newpipe/extractor/ListExtractor.kt |
| 34 | - org/schabi/newpipe/extractor/Info.kt |
| 35 | - org/schabi/newpipe/extractor/ListInfo.kt |
| 36 | - org/schabi/newpipe/extractor/InfoItem.kt |
| 37 | - org/schabi/newpipe/extractor/InfoItemExtractor.kt |
| 38 | - org/schabi/newpipe/extractor/InfoItemsCollector.kt |
| 39 | - org/schabi/newpipe/extractor/MultiInfoItemsCollector.kt |
| 40 | - org/schabi/newpipe/extractor/Collector.kt |
| 41 | - org/schabi/newpipe/extractor/Page.kt |
| 42 | - org/schabi/newpipe/extractor/MediaFormat.kt |
| 43 | - org/schabi/newpipe/extractor/Image.kt |
| 44 | - org/schabi/newpipe/extractor/MetaInfo.kt |
| 45 | ### services/ + stream/ + channel/ + playlist/ + search/ — per-entity extractors |
| 46 | - org/schabi/newpipe/extractor/services/ — per-service implementations (incl. youtube) |
| 47 | - org/schabi/newpipe/extractor/stream/ — stream info + items |
| 48 | - org/schabi/newpipe/extractor/channel/ — channel info + items |
| 49 | - org/schabi/newpipe/extractor/playlist/ — playlist info + items |
| 50 | - org/schabi/newpipe/extractor/search/ — searcher + results |
| 51 | - org/schabi/newpipe/extractor/suggestion/ — query suggestions |
| 52 | - org/schabi/newpipe/extractor/kiosk/ — trending-style feeds |
| 53 | - org/schabi/newpipe/extractor/comments/ — comment threads |
| 54 | - org/schabi/newpipe/extractor/subscription/ — subscription extractors |
| 55 | ### linkhandler/ + localization/ + timeago/ + utils/ + downloader/ + exceptions/ — plumbing |
| 56 | - org/schabi/newpipe/extractor/linkhandler/ — URL ↔ id routing |
| 57 | - org/schabi/newpipe/extractor/localization/ — Localization + ContentCountry |
| 58 | - org/schabi/newpipe/extractor/timeago/ — locale-aware relative-time parsing |
| 59 | - org/schabi/newpipe/extractor/utils/ — shared parsing helpers |
| 60 | - org/schabi/newpipe/extractor/downloader/ — Downloader abstraction the host injects |
| 61 | - org/schabi/newpipe/extractor/exceptions/ — extraction error hierarchy |
| 62 | |
| 63 | ## Verify (this module only) |
| 64 | ``` |
| 65 | ./gradlew :youpipe:extractor:compileDevKotlin |
| 66 | ./gradlew :youpipe:extractor:lint |
| 67 | ``` |