How minerchu/dongguatv works
Purpose and Entry Points
DongguaTV is a self-hosted Node.js video-resource aggregation service. It searches multiple third-party video APIs, returns detail/playback metadata, checks source latency, and exposes a small browser UI plus an administrator UI.
Runtime entry point: server.js. User interfaces: public/index.html and public/admin.html.
HTTP Service and API Boundary
The Express server serves the static frontend and owns the application API surface:
• search: GET /api/search?wd=...
• source-specific detail: GET /api/detail?site_key=...&id=...
• hot content: GET /api/hot
• source health/latency: GET /api/check?key=...
• administrator login and source configuration endpoints.
server.js is the boundary between untrusted browser requests and external resource-site APIs. It uses Axios for outbound requests, CORS for browser access, and Node-cache for transient caching.
Multi-Source Aggregation Pipeline
Search requests fan out from server.js to enabled upstream video-source APIs, normalize their returned items, and aggregate results for the frontend. The service is designed around a configurable catalog of 30+ resource providers, each identified by a key, name, API endpoint, and activation state.
Detail requests remain source-scoped: the selected site_key determines which provider endpoint receives the movie ID. This preserves provider-specific playback and metadata handling rather than attempting to merge detail records globally.
Source Health and Result Prioritization
The source-check endpoint in server.js measures whether an individual provider is reachable and responsive. The README indicates that response speed is used to prefer faster resources, making source latency a first-class operational signal alongside source enablement.
Failure isolation is important: upstream providers are external, heterogeneous, and may be unavailable; one failed provider should not prevent aggregate search responses from other providers.
Browser Clients
The public client, public/index.html, implements search, hot-content display, result browsing, detail presentation, and playback-link selection. It also carries the TMDb API-key configuration described in the README, so TMDb enrichment occurs from the client-side integration boundary.
public/admin.html is a separate administrative client for authenticating and reading/updating provider configuration. Shared presentation assets live in public/style.css.
Persistence and Administration
Provider configuration is persisted as a JSON-file database according to the README (including active/inactive switches and custom upstream URLs). The server’s admin routes in server.js load and update this configuration, which directly controls the aggregation fan-out set. The documented default administrator password is a deployment risk and should be overridden outside local development.
Deployment Model
The application runs on Node.js 16+ and defaults to port 3000. Container deployment is defined by Dockerfile, orchestrated with docker-compose.yml, and bootstrapped through entrypoint.sh. Static UI and API share one server/container, with optional production reverse-proxy placement recommended by the project documentation.
Main entry points: server.js Express server · index.html Public UI · style.css Shared styles · docker-compose.yml Container orchestration
Components 16
Browser clients
- Public UI · Searches, browses results, and selects playback links.
public/index.html - Admin UI · Authenticates and manages video sources.
public/admin.html - Shared styles
public/style.css
Node.js service
- Express server · Serves static clients and owns the API boundary.
server.js - Search aggregation · Queries enabled sources, normalizes items, and isolates source failures.
server.js - Source-scoped detail · Routes a movie ID to its selected provider.
server.js - Source health check · Measures provider reachability and response speed.
server.js - Admin API · Authenticates administrators and updates source settings.
server.js - Source catalog · Provider keys, endpoints, and active states.
- JSON-file database · Persists provider configuration.
External services
- TMDb · Client-side enrichment integration.
- Video-source APIs · Heterogeneous upstream search and detail APIs.
Deployment
- Container image
Dockerfile - Container orchestration
docker-compose.yml - Container bootstrap
entrypoint.sh - Optional reverse proxy
Connections 21
- Public UI → Express server: static UI and public API
- Admin UI → Express server: admin API
- Shared styles → Public UI: styles
- Shared styles → Admin UI: styles
- Public UI → TMDb: client enrichment
- Express server → Search aggregation: GET /api/search
- Express server → Source-scoped detail: GET /api/detail
- Express server → Source health check: GET /api/check
- Express server → Admin API: admin routes
- Search aggregation → Source catalog: enabled sources
- Search aggregation → Video-source APIs: fan-out search
- Source-scoped detail → Source catalog: resolve site_key
- Source-scoped detail → Video-source APIs: provider detail
- Source health check → Video-source APIs: latency probe
- Source health check → Source catalog: prioritize faster sources
- Admin API → Source catalog: read and update
- Source catalog → JSON-file database: persisted in
- Container orchestration → Container image: builds
- Container orchestration → Container bootstrap: runs
- Container bootstrap → Express server: starts
- Optional reverse proxy → Express server: optional production routing