5.0 KiB
5.0 KiB
News Live Streams Collector Format
The news_live_streams collector accepts a "channel directory JSON" as input rather than scraping web pages directly.
Goals:
- Allow the backend to stably ingest live news streams from around the world
- Ensure the Earth page TV module always consumes a consistent structure
- Make it easy to integrate channel directories like
worldmonitorthat mix YouTube / HLS / iframe sources
Recommended JSON Structure
{
"sources": [
{
"id": "bbc-world-news",
"name": "BBC World News",
"provider": "BBC",
"region": "UK",
"language": "en",
"source_type": "youtube",
"youtube_video_id": "dQw4w9WgXcQ",
"youtube_channel": "https://www.youtube.com/@BBCNews",
"embed_url": "",
"stream_url": "",
"homepage_url": "https://www.youtube.com/@BBCNews/live",
"poster_url": "",
"sort_order": 220,
"is_enabled": true,
"notes": "Primary English global news channel"
},
{
"id": "france24-en",
"name": "France 24 English",
"provider": "France 24",
"region": "France",
"language": "en",
"source_type": "hls",
"stream_url": "https://example.com/live.m3u8",
"homepage_url": "https://www.france24.com/en/live",
"sort_order": 230,
"is_enabled": true
},
{
"id": "cctv4-page",
"name": "CCTV-4 Chinese International",
"provider": "CCTV",
"region": "China",
"language": "zh-CN",
"source_type": "iframe",
"embed_url": "https://tv.cctv.com/live/cctv4/",
"homepage_url": "https://tv.cctv.com/live/cctv4/",
"sort_order": 10,
"is_enabled": true
}
]
}
Field Conventions
id: unique identifier, should be stablename: channel display nameprovider: provider nameregion: country or regionlanguage: language codesource_type:iframe/hls/video/external/youtubeembed_url: page suitable for iframe embeddingstream_url: direct video stream URLhomepage_url: official website or channel pageyoutube_video_id: YouTube live video IDyoutube_channel: YouTube channel handle or channel URLposter_url: cover image, optionalsort_order: sort value, smaller = higher in the listis_enabled: whether enablednotes: brief notes
Panel Behavior Conventions
youtube- Prefers
youtube_video_id - When embedding is not possible, at least keep
youtube_channelorhomepage_urlfor external opening
- Prefers
hls/video- Prefers
stream_url
- Prefers
iframe- Prefers
embed_url
- Prefers
external- No embedding attempt; only keeps external open link
Current Implementation Status
- The backend settings page supports manually maintaining channel directories
- The Earth TV module merges:
- Manually configured sources
- Sources collected by the
news_live_streamscollector
- The current default fallback source is CCTV-4 Chinese International
- When no override is configured,
news_live_streamsdefaults toiptv-org:channels.jsonstreams.jsonlogos.jsonand automatically filters for news-category channel directories
Collector Configuration
news_live_streams does not need a separate new page; it reuses Collector Settings under /settings:
endpoint- Channel directory JSON API URL
auth_typenone/bearer/api_key/basic
headers- Additional request headers
config- Collector request and parsing behavior
Supported config Fields
{
"timeout": 30,
"method": "GET",
"params": {
"region": "global"
},
"body_type": "json",
"body": {
"include_disabled": false
},
"response_path": "payload.channels"
}
timeout: request timeout in secondsmethod:GETorPOSTparams: query parameter objectbody_type:jsonorformbody: request body forPOSTjson_body: explicit JSON request body, takes priority overbodyform_body: explicit form request body, takes priority overbodyresponse_path: path to the channel array in the response JSON, supports dot notation, e.g.:payload.channelsdata.itemsresult.streams
Authentication Details
bearer: usesAuthorization: Bearer <token>api_key: sent as request header by default; ifauth_config.in = "query", sent as query parambasic: uses HTTP Basic Authorization
Compatible Response Structures
The collector first tries to read:
- Top-level array
- Or an array under these common fields:
sourcesstreamschannelsitemsresultsdata
It also accepts these field aliases:
id/source_id/slug/channel_id/codename/title/channel/display_nameprovider/publisher/networkstream_url/stream/playback_url/hls_url/m3u8_urlembed_url/embed/page_urlhomepage_url/source_url/websitelanguage/lang/localeyoutube_video_id/video_idyoutube_channel/channel_handle