# fxy1812/tvbox architecture

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

- Interactive diagram: https://gitdiagram.com/fxy1812/tvbox
- Repository: https://github.com/fxy1812/tvbox

## Overview

This repository is a collection of TVBox/OK影视 and 猫影视 configuration scripts and source adapters, rather than a single application. A user selects a configured source in a compatible player, searches or browses its catalog, opens a detail, then plays a stream; adapters also cover live TV and cloud-drive searches. The tree and README establish the broad source families and capabilities, while sampled code shows the 猫影视 spider and Ali/Quark cloud-play paths. Many adapters and optional integrations were not sampled, so their internal links are omitted.

Main entry points: [`cat/tjs/js/spider.js`](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/js/spider.js) (Spider lifecycle), [`cat/tjs/lib/cloud.js`](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/cloud.js) (Cloud play router), [`cat/tjs/js/pan_search.js`](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/js/pan_search.js) (Pan search adapter), [`cat/tjs/lib/vod.js`](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/vod.js) (VOD models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cat_adapters["猫影视 adapters"]
  node_cat_config["猫影视 configuration<br/>[index.config.js]"]
  node_cat_adapter["猫影视 source adapters"]
  node_nivod["NiVod adapter<br/>[nivod_op.js]"]
  node_cat_core["Cat runtime core<br/>[cat.js]"]
  node_pansearch["Pan search adapter<br/>[pan_search.js]"]
end

subgraph group_tjs_runtime["Spider runtime"]
  node_spider["Spider lifecycle<br/>[spider.js]"]
  node_vod_models["VOD models<br/>[vod.js]"]
  node_huya["Huya live adapter<br/>[huya.js]"]
  node_danmu["Danmu spider<br/>[danmuSpider.js]"]
  node_hls_cache["HLS cache<br/>[ffm3u8_open.js]"]
  node_hls["HLS utilities<br/>[hls.js]"]
  node_logging["Spider logging<br/>[log.js]"]
  node_cat_tjs_sources["Additional Cat spiders"]
end

subgraph group_cloud_media["Cloud media"]
  node_ali_facade["Ali drive facade<br/>[ali.js]"]
  node_ali_api["Ali drive API<br/>[ali_api.js]"]
  node_cloud_router["Cloud play router<br/>[cloud.js]"]
  node_ali_cloud["Ali cloud client<br/>[ali.js]"]
  node_quark_cloud["Quark cloud client<br/>[quark.js]"]
end

subgraph group_other_sources["Other source collections"]
  node_other_adapters["TVBox and FTY sources"]
  node_xiaosa_adapters["Xiaosa sources"]
end

node_viewer(("Player user"))
node_cloud_store[("Cloud drive services")]

node_viewer -->|"selects source"| node_cat_config
node_cat_config -->|"configures"| node_cat_adapter
node_nivod -->|"uses runtime"| node_cat_core
node_pansearch -->|"parses pages"| node_cat_core
node_pansearch -->|"builds results"| node_vod_models
node_pansearch -->|"requests cloud playback"| node_cloud_router
node_spider -->|"creates details"| node_vod_models
node_spider -->|"initializes cloud"| node_cloud_router
node_spider -->|"logs activity"| node_logging
node_spider -->|"caches playlists"| node_hls_cache
node_spider -->|"dispatches support"| node_danmu
node_spider -->|"uses playlist tools"| node_hls
node_huya -->|"creates live entries"| node_vod_models
node_cloud_router -->|"routes Ali requests"| node_ali_cloud
node_cloud_router -->|"routes Quark requests"| node_quark_cloud
node_ali_cloud -.->|"reads and plays"| node_cloud_store
node_quark_cloud -.->|"reads and plays"| node_cloud_store
node_ali_facade -->|"delegates API calls"| node_ali_api
node_cat_adapter -.->|"returns media results"| node_viewer
node_other_adapters -.->|"provides source scripts"| node_viewer
node_xiaosa_adapters -.->|"provides source scripts"| node_viewer
node_cat_tjs_sources -.->|"provides spider scripts"| node_viewer

click node_cat_config "https://github.com/fxy1812/tvbox/blob/master/cat/18_dist/index.config.js"
click node_cat_adapter "https://github.com/fxy1812/tvbox/tree/master/cat/js"
click node_nivod "https://github.com/fxy1812/tvbox/blob/master/cat/js/nivod_op.js"
click node_cat_core "https://github.com/fxy1812/tvbox/blob/master/cat/js/lib/cat.js"
click node_ali_facade "https://github.com/fxy1812/tvbox/blob/master/cat/js/lib/ali.js"
click node_ali_api "https://github.com/fxy1812/tvbox/blob/master/cat/js/lib/ali_api.js"
click node_pansearch "https://github.com/fxy1812/tvbox/blob/master/cat/tjs/js/pan_search.js"
click node_spider "https://github.com/fxy1812/tvbox/blob/master/cat/tjs/js/spider.js"
click node_vod_models "https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/vod.js"
click node_cloud_router "https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/cloud.js"
click node_ali_cloud "https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/ali.js"
click node_quark_cloud "https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/quark.js"
click node_huya "https://github.com/fxy1812/tvbox/blob/master/cat/tjs/js/huya.js"
click node_danmu "https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/danmuSpider.js"
click node_hls_cache "https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/ffm3u8_open.js"
click node_hls "https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/hls.js"
click node_logging "https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/log.js"
click node_other_adapters "https://github.com/fxy1812/tvbox/tree/master/js"
click node_xiaosa_adapters "https://github.com/fxy1812/tvbox/tree/master/xiaosa/js"
click node_cat_tjs_sources "https://github.com/fxy1812/tvbox/tree/master/cat/tjs/js"

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_cat_config,node_cat_adapter,node_nivod,node_cat_core,node_pansearch,node_viewer toneBlue
class node_spider,node_vod_models,node_huya,node_danmu,node_hls_cache,node_hls,node_logging,node_cat_tjs_sources,node_cloud_store toneAmber
class node_ali_facade,node_ali_api,node_cloud_router,node_ali_cloud,node_quark_cloud toneMint
class node_other_adapters,node_xiaosa_adapters toneRose
```

## Components

### 猫影视 adapters

- [猫影视 configuration](https://github.com/fxy1812/tvbox/blob/master/cat/18_dist/index.config.js): `cat/18_dist/index.config.js`
- [猫影视 source adapters](https://github.com/fxy1812/tvbox/tree/master/cat/js): `cat/js`
- [NiVod adapter](https://github.com/fxy1812/tvbox/blob/master/cat/js/nivod_op.js): `cat/js/nivod_op.js`
- [Cat runtime core](https://github.com/fxy1812/tvbox/blob/master/cat/js/lib/cat.js): `cat/js/lib/cat.js`
- [Pan search adapter](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/js/pan_search.js): `cat/tjs/js/pan_search.js`

### Spider runtime

- [Spider lifecycle](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/js/spider.js): `cat/tjs/js/spider.js`
- [VOD models](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/vod.js): `cat/tjs/lib/vod.js`
- [Huya live adapter](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/js/huya.js): `cat/tjs/js/huya.js`
- [Danmu spider](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/danmuSpider.js): `cat/tjs/lib/danmuSpider.js`
- [HLS cache](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/ffm3u8_open.js): `cat/tjs/lib/ffm3u8_open.js`
- [HLS utilities](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/hls.js): `cat/tjs/lib/hls.js`
- [Spider logging](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/log.js): `cat/tjs/lib/log.js`
- [Additional Cat spiders](https://github.com/fxy1812/tvbox/tree/master/cat/tjs/js): `cat/tjs/js`

### Cloud media

- [Ali drive facade](https://github.com/fxy1812/tvbox/blob/master/cat/js/lib/ali.js): `cat/js/lib/ali.js`
- [Ali drive API](https://github.com/fxy1812/tvbox/blob/master/cat/js/lib/ali_api.js): `cat/js/lib/ali_api.js`
- [Cloud play router](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/cloud.js): `cat/tjs/lib/cloud.js`
- [Ali cloud client](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/ali.js): `cat/tjs/lib/ali.js`
- [Quark cloud client](https://github.com/fxy1812/tvbox/blob/master/cat/tjs/lib/quark.js): `cat/tjs/lib/quark.js`

### Other source collections

- [TVBox and FTY sources](https://github.com/fxy1812/tvbox/tree/master/js): `js`
- [Xiaosa sources](https://github.com/fxy1812/tvbox/tree/master/xiaosa/js): `xiaosa/js`

### Other components

- **Player user**
- **Cloud drive services**

## Connections

- Player user → 猫影视 configuration: selects source
- 猫影视 configuration → 猫影视 source adapters: configures
- NiVod adapter → Cat runtime core: uses runtime (evidence: `cat/js/nivod_op.js`)
- Pan search adapter → Cat runtime core: parses pages (evidence: `cat/tjs/js/pan_search.js`)
- Pan search adapter → VOD models: builds results (evidence: `cat/tjs/js/pan_search.js`)
- Pan search adapter → Cloud play router: requests cloud playback (evidence: `cat/tjs/js/pan_search.js`)
- Spider lifecycle → VOD models: creates details (evidence: `cat/tjs/js/spider.js`)
- Spider lifecycle → Cloud play router: initializes cloud (evidence: `cat/tjs/js/spider.js`)
- Spider lifecycle → Spider logging: logs activity (evidence: `cat/tjs/js/spider.js`)
- Spider lifecycle → HLS cache: caches playlists (evidence: `cat/tjs/js/spider.js`)
- Spider lifecycle → Danmu spider: dispatches support (evidence: `cat/tjs/js/spider.js`)
- Spider lifecycle → HLS utilities: uses playlist tools (evidence: `cat/tjs/js/spider.js`)
- Huya live adapter → VOD models: creates live entries (evidence: `cat/tjs/js/huya.js`)
- Cloud play router → Ali cloud client: routes Ali requests (evidence: `cat/tjs/lib/cloud.js`)
- Cloud play router → Quark cloud client: routes Quark requests (evidence: `cat/tjs/lib/cloud.js`)
- Ali cloud client → Cloud drive services: reads and plays
- Quark cloud client → Cloud drive services: reads and plays
- Ali drive facade → Ali drive API: delegates API calls (evidence: `cat/js/lib/ali.js`)
- 猫影视 source adapters → Player user: returns media results
- TVBox and FTY sources → Player user: provides source scripts
- Xiaosa sources → Player user: provides source scripts
- Additional Cat spiders → Player user: provides spider scripts
