# wiojelt/cloudstream-builder architecture

> Architecture diagram of the GitHub repository wiojelt/cloudstream-builder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wiojelt/cloudstream-builder
- Repository: https://github.com/wiojelt/cloudstream-builder

## Overview

The supplied tree exposes the extractor runtime of CloudStream Builder, rather than its site-discovery, Kotlin-provider generation, or packaging workflow. The main visible path is a CloudStream extractor request routed through the registry and per-host extraction, with fallback link discovery and adaptive-link validation. The README documents wider builder capabilities, but their implementation paths are not present here; unsampled extractor families are therefore represented as subsystem nodes without inferred call chains.

Main entry points: [`cloudstream-builder/extractors/oce/kotlin/ExtractorRegistry.kt`](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/ExtractorRegistry.kt) (Provider registry), [`cloudstream-builder/extractors/oce/kotlin/MasterLinkGenerator.kt`](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/MasterLinkGenerator.kt) (Link generation), [`cloudstream-builder/extractors/oce/core/ExtractorFallback.kt`](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/core/ExtractorFallback.kt) (Extractor fallback), [`cloudstream-builder/extractors/oce/kotlin/M3u8MasterVerifier.kt`](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/M3u8MasterVerifier.kt) (HLS master verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_registry["Extractor registry"]
  node_registry["Provider registry"]
  node_configs[("Config registry")]
  node_configmodel["Extractor configs<br/>[ExtractorConfig.kt]"]
  node_configparser["JSON config parser"]
end

subgraph group_runtime["Extraction runtime"]
  node_configengine["Config-driven extraction"]
  node_oceproviders["OCE host extractors"]
  node_turkproviders["Turkish host extractors"]
  node_fallback["Extractor fallback"]
end

subgraph group_links["Link processing"]
  node_regex["Media URL patterns"]
  node_masterlink["Link generation"]
  node_headerprobe["Header probing"]
  node_hlsverify["HLS master verification"]
  node_quality["Adaptive quality selection"]
end

node_cloudstream(("CloudStream caller"))
node_mediahosts{{"Video host services"}}
node_player(("CloudStream player"))

node_cloudstream -.->|"requests extractor"| node_registry
node_registry -->|"loads configs"| node_configs
node_registry -->|"builds configured"| node_configengine
node_configparser -->|"creates model"| node_configmodel
node_configs -.->|"parses JSON"| node_configparser
node_configengine -->|"generates links"| node_masterlink
node_registry -->|"registers providers"| node_oceproviders
node_registry -.->|"registers providers"| node_turkproviders
node_oceproviders -.->|"requests media"| node_mediahosts
node_turkproviders -.->|"requests media"| node_mediahosts
node_fallback -->|"matches extractor"| node_registry
node_fallback -->|"builds direct links"| node_masterlink
node_fallback -->|"scans response"| node_regex
node_masterlink -->|"probes headers"| node_headerprobe
node_masterlink -->|"verifies master"| node_hlsverify
node_masterlink -.->|"emits links"| node_player
node_headerprobe -->|"tests requests"| node_mediahosts
node_hlsverify -->|"fetches playlist"| node_mediahosts
node_quality -->|"probes variants"| node_mediahosts
node_hlsverify -->|"uses picker"| node_quality

click node_registry "https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/ExtractorRegistry.kt"
click node_configs "https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/core/ExtractorConfigRegistry.kt"
click node_configmodel "https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/core/ExtractorConfig.kt"
click node_configparser "https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/core/ExtractorConfigParser.kt"
click node_configengine "https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/core/ConfigDrivenExtractor.kt"
click node_oceproviders "https://github.com/wiojelt/cloudstream-builder/tree/main/cloudstream-builder/extractors/oce/kotlin"
click node_turkproviders "https://github.com/wiojelt/cloudstream-builder/tree/main/cloudstream-builder/extractors/turk"
click node_fallback "https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/core/ExtractorFallback.kt"
click node_regex "https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/CompiledRegexPatterns.kt"
click node_masterlink "https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/MasterLinkGenerator.kt"
click node_headerprobe "https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/AdaptiveHeaderProbe.kt"
click node_hlsverify "https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/M3u8MasterVerifier.kt"
click node_quality "https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/AdaptiveQualityPicker.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_registry,node_configs,node_configmodel,node_configparser toneBlue
class node_configengine,node_oceproviders,node_turkproviders,node_fallback toneAmber
class node_regex,node_masterlink,node_headerprobe,node_hlsverify,node_quality toneMint
class node_cloudstream,node_mediahosts,node_player toneIndigo
```

## Components

### Extractor registry

- [Provider registry](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/ExtractorRegistry.kt): `cloudstream-builder/extractors/oce/kotlin/ExtractorRegistry.kt`
- [Config registry](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/core/ExtractorConfigRegistry.kt): `cloudstream-builder/extractors/oce/core/ExtractorConfigRegistry.kt`
- [Extractor configs](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/core/ExtractorConfig.kt): `cloudstream-builder/extractors/oce/core/ExtractorConfig.kt`
- [JSON config parser](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/core/ExtractorConfigParser.kt): `cloudstream-builder/extractors/oce/core/ExtractorConfigParser.kt`

### Extraction runtime

- [Config-driven extraction](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/core/ConfigDrivenExtractor.kt): `cloudstream-builder/extractors/oce/core/ConfigDrivenExtractor.kt`
- [OCE host extractors](https://github.com/wiojelt/cloudstream-builder/tree/main/cloudstream-builder/extractors/oce/kotlin): `cloudstream-builder/extractors/oce/kotlin`
- [Turkish host extractors](https://github.com/wiojelt/cloudstream-builder/tree/main/cloudstream-builder/extractors/turk): `cloudstream-builder/extractors/turk`
- [Extractor fallback](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/core/ExtractorFallback.kt): `cloudstream-builder/extractors/oce/core/ExtractorFallback.kt`

### Link processing

- [Media URL patterns](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/CompiledRegexPatterns.kt): `cloudstream-builder/extractors/oce/kotlin/CompiledRegexPatterns.kt`
- [Link generation](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/MasterLinkGenerator.kt): `cloudstream-builder/extractors/oce/kotlin/MasterLinkGenerator.kt`
- [Header probing](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/AdaptiveHeaderProbe.kt): `cloudstream-builder/extractors/oce/kotlin/AdaptiveHeaderProbe.kt`
- [HLS master verification](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/M3u8MasterVerifier.kt): `cloudstream-builder/extractors/oce/kotlin/M3u8MasterVerifier.kt`
- [Adaptive quality selection](https://github.com/wiojelt/cloudstream-builder/blob/main/cloudstream-builder/extractors/oce/kotlin/AdaptiveQualityPicker.kt): `cloudstream-builder/extractors/oce/kotlin/AdaptiveQualityPicker.kt`

### Other components

- **CloudStream caller**
- **Video host services**
- **CloudStream player**

## Connections

- CloudStream caller → Provider registry: requests extractor
- Provider registry → Config registry: loads configs (evidence: `cloudstream-builder/extractors/oce/kotlin/ExtractorRegistry.kt`)
- Provider registry → Config-driven extraction: builds configured (evidence: `cloudstream-builder/extractors/oce/kotlin/ExtractorRegistry.kt`)
- JSON config parser → Extractor configs: creates model (evidence: `cloudstream-builder/extractors/oce/core/ExtractorConfigParser.kt`)
- Config registry → JSON config parser: parses JSON
- Config-driven extraction → Link generation: generates links (evidence: `cloudstream-builder/extractors/oce/core/ConfigDrivenExtractor.kt`)
- Provider registry → OCE host extractors: registers providers (evidence: `cloudstream-builder/extractors/oce/kotlin/ExtractorRegistry.kt`)
- Provider registry → Turkish host extractors: registers providers
- OCE host extractors → Video host services: requests media
- Turkish host extractors → Video host services: requests media
- Extractor fallback → Provider registry: matches extractor (evidence: `cloudstream-builder/extractors/oce/core/ExtractorFallback.kt`)
- Extractor fallback → Link generation: builds direct links (evidence: `cloudstream-builder/extractors/oce/core/ExtractorFallback.kt`)
- Extractor fallback → Media URL patterns: scans response (evidence: `cloudstream-builder/extractors/oce/core/ExtractorFallback.kt`)
- Link generation → Header probing: probes headers (evidence: `cloudstream-builder/extractors/oce/kotlin/MasterLinkGenerator.kt`)
- Link generation → HLS master verification: verifies master (evidence: `cloudstream-builder/extractors/oce/kotlin/MasterLinkGenerator.kt`)
- Link generation → CloudStream player: emits links
- Header probing → Video host services: tests requests (evidence: `cloudstream-builder/extractors/oce/kotlin/AdaptiveHeaderProbe.kt`)
- HLS master verification → Video host services: fetches playlist (evidence: `cloudstream-builder/extractors/oce/kotlin/M3u8MasterVerifier.kt`)
- Adaptive quality selection → Video host services: probes variants (evidence: `cloudstream-builder/extractors/oce/kotlin/AdaptiveQualityPicker.kt`)
- HLS master verification → Adaptive quality selection: uses picker (evidence: `cloudstream-builder/extractors/oce/kotlin/M3u8MasterVerifier.kt`)
