Tip
The project supports four ways to run: GitHub Actions, command line, GUI, and Docker. Choose the one that best fits your environment.
Contents
All runtimes share the update flow below: prepare templates and sources, match channels, apply the test mode, and export results. EPG is fetched and written separately. See the architecture guide for UI and background dependencies.
quick stops at the channel target, full tests all candidates, and manual collects candidates for GUI retesting. Source EPG extraction fetches subscriptions before EPG; otherwise both can run concurrently.
Visit the main repository's GitHub Pages results page to copy online links for player subscriptions, preview files, or download results. No fork or workflow run is needed to use these results. To generate results with your own configuration, follow the deployment steps below.
Use GitHub Actions to generate results manually, serve player subscriptions from the fork's own GitHub Pages site, and create a separate Release for every run to download and save result files.
Important
Because GitHub resources are limited, the workflow can only be triggered manually. Generated results are deployed
through a Pages artifact and a separate prerelease for every run. They are not committed to Git, and no gh-pages
branch is created. For frequent or scheduled runs, use Docker, the command line, the GUI, or external object storage.
generate prepares Pages and Release artifacts. publish-release creates the playlist prerelease for this run. deploy-pages waits for generation and Release publication to succeed before deploying. Pages provides subscriptions and previews; its Download buttons point to this Release. These playlist Releases are separate from desktop update packages.
Open the IPTV-API project and click Star to favorite it (Your Star is my motivation for continuous updates).

Open the Fork creation page to copy this repository to your personal account.

- Name your personal repository as you like (the final live source result link depends on this name), here we use the
default
iptv-apias an example. - Confirm the information is correct and click to create.
Pages must be enabled separately in every fork; this setting is not inherited from the upstream repository:
- Open
Settingsin your fork. - Select
Pagesin the sidebar. - Under
Build and deployment, setSourcetoGitHub Actions.
Do not create a gh-pages branch or commit output/ to any branch. The workflow deploys a temporary Pages artifact directly to:
https://your-github-username.github.io/repository-name/
If Pages is not enabled first, the workflow fails at Configure GitHub Pages.
Since this project will continue to iterate and optimize, if you want to get the latest updates, you can do the following:
Warning
If you only want to update your fork, do not click Contribute or Open pull request to create a PR.
Go to your own repository and use Sync fork → Update branch.
If a synchronization conflict occurs, back up user_*.ini, custom templates, and source files before using
Discard commits as described below.
Create a Pull Request only when you intentionally want to contribute code to the upstream repository.
Follow this project, and subsequent update logs will be released as releases, and you will receive email
notifications.

- Normal update:
Go back to the homepage of your forked repository, if there are updates, click Sync fork, Update branch to confirm
and update the latest code.

- No
Update branchbutton, update conflict:
This is because some files conflict with the default files of the main repository, click Discard commits to update the
latest code.

Important
To avoid conflicts when updating the code later, it is recommended to copy files in the config directory and rename
them by adding the user_ prefix before modifying.
When you click to confirm creation in step one, you will automatically jump to your personal repository after success. At this time, your personal repository has been created, and you can customize your live source channel menu!
You can copy and refer to the format of the default template for subsequent operations.
- Click the
configdirectory. - Create a file.
- Name the template file
user_demo.txt. - The template file needs to be written in the format of (channel category, #genre#), (channel name, channel interface)
with a comma. If you want to whitelist the interface (no speed test, keep it at the top of the result), you can add
$!after the address, such as http://xxx$!. You can also add additional information, such as: http://xxx$! whitelist. - Click
Commit changes...to save.
Like editing templates, modify the runtime configuration.
- Create a file.
- Name the configuration file
user_config.ini. - Paste the default configuration. When creating
user_config.ini, enter only the configuration items you want to modify; you do not need to copy the entireconfig.ini. - Modify the template and result file configuration:
- source_file = config/user_demo.txt
- final_file = output/user_result.txt
- Click
Commit changes...to save.
Important
Keep [Settings] at the top of user_config.ini; otherwise, the custom configuration below does not take effect.
Adjust the configuration as needed, here is the default configuration description: Configuration parameters
Note
- Some players, such as
PotPlayer, cannot parse supplementary interface information. Setopen_url_info = False(GUI: clear “Display interface information”) if this prevents playback. - If your network supports IPv6, set
ipv6_support = True(GUI: select “Force assume the current network supports IPv6”) to skip detection. - For playback/speed-test request headers, configure the global
user_agentor appendUA=valueto a URL inconfig/subscribe.txt. The UA is written to.m3uresults without requiringopen_headers. locationandispfilter out non-matching interfaces by default. Withopen_supply = True, they are retained as lower-priority fallbacks.- Use
sort_bywith comma-separatedspeed,delay, andresolutionvalues. For example,resolution,speedsorts by resolution and then speed.
Subscription sources (config/subscribe.txt)
Important
The project provides no default subscription addresses. Add your own; otherwise, update results may be empty.
Both .txt and .m3u URLs are supported as subscriptions, and the program reads channel interface entries from them
sequentially.

If a subscription source requires a specific User-Agent to be accessed, append UA=value after the subscription URL
(wrap it in quotes when it contains spaces), for example:
https://example.com/sub.m3u UA=okHttp/Mod-1.5.0.0
https://example.com/sub2.m3u UA="Mozilla/5.0 xxx"
This UA is used for: fetching the subscription content, speed testing the interfaces under that subscription, and
writing into the .m3u result (for players) — no need to enable open_headers. If you want to apply one UA to all
interfaces (instead of adding it one by one), set the global user_agent in the configuration. Priority: interface's
own UA (#EXTVLCOPT embedded in m3u) > subscription URL UA > global user_agent > built-in default UA. Note: request
headers can only be written into the .m3u result; the .txt format cannot carry a UA.
-
Local sources(
config/local.txt)Channel interface data comes from local files. If there are multiple local source files, you can create a
localdirectory underconfigto store them; the program will read the channel interface data from them in order. Supportstxtandm3ufiles. -
Logo source (
config/logo)Directory for channel logo images. The program will match corresponding logo images in this directory based on the channel names in the template. If a remote library
logo_urlis used, the remote source will be preferred. -
EPG Source (
config/epg.txt)The source of program guide information. The program will sequentially fetch the program guide data from the subscription addresses in the file and aggregate the output.
-
Channel Aliases (
config/alias.txt)A list of aliases for channel names, used to map multiple names to a single name when fetching from the interface, improving the fetch volume and accuracy. Format: TemplateChannelName,Alias1,Alias2,Alias3.
The program normalizes Traditional/Simplified Chinese, case, and common separators, then matches exact aliases and constrained regex rules. You normally do not need to change a template merely because a source spells a channel differently. Distinct channels are not merged, and ambiguous aliases are excluded. Prefix a custom regex with
re:and ensure it distinguishes related channels such as CCTV-5 and CCTV-5+. -
Blacklist (
config/blacklist.txt)Interfaces that match the blacklist keywords will be filtered and not collected, such as low-quality interfaces with ads.
-
Whitelist (
config/whitelist.txt)Interfaces or subscription sources in the whitelist will not participate in speed testing and will be prioritized at the top of the results. Fill in the channel name to directly retain the record in the final result, such as: CCTV-1, interface address, only filling in the interface address will apply to all channels, multiple records are entered on separate lines.
Tip
If a run produces no channel data, the logs distinguish between missing sources, empty subscription responses,
unmatched channels, and results removed by filters. In the GUI, use “Configure sources” on the dashboard. Docker users
should verify that /iptv-api/config/subscribe.txt inside the container is not empty.
After updating your template and configuration, use Actions to generate and publish results manually.
Since the Actions workflow of the forked repository is disabled by default, you need to manually confirm to enable it,
click the button in the red box to confirm enabling.
After enabling Actions, start your first manual generation below.
- Click
Generate playlist manuallyunder theWorkflowscategory. - Since the workflow of the forked repository is disabled by default, click the
Enable workflowbutton to confirm the activation.
Now you can run the update workflow.
- Click
Run workflow. - Here you can switch to the branch you want to run. Since the fork defaults to the
masterbranch, if the template and configuration you modified are also in themasterbranch, just choosemasterhere, and clickRun workflowto confirm the run.
Wait a moment, and you will see that your first update workflow is running!
Note
Runtime depends on the template size, page settings, and network conditions. Speed testing may take 30–60 minutes and runs in a generation job with a five-hour timeout. The ten-minute Pages deployment limit applies only to the separate deployment job after generation completes; it does not include speed-testing time.
If you feel that this update is not quite right and you need to modify the template or configuration before running
again, you can click Cancel run to cancel this run.

If everything is normal, after a short wait, you will see that the workflow has been executed successfully (green check
mark).

The workflow summary contains Pages links and Release download URLs. For online player use, open the Pages page and use the applicable result address:
https://your-github-username.github.io/repository-name/result.m3u
https://your-github-username.github.io/repository-name/result.txt
https://your-github-username.github.io/repository-name/epg.gz
The Pages results page lets you preview files; its Download buttons point to this run's Release assets, preserving per-run download counts and historical files. Redirects and download-oriented response headers make Release URLs unsuitable for player subscriptions. Asset URLs use this format:
https://github.com/your-github-username/repository-name/releases/download/playlist-20260920-103000-utc-plus-0800/result.m3u
result.txt is always published. result.m3u and epg.gz exist only when their features are enabled and generation succeeds. The M3U uses the Pages link for EPG.
Every file on the Pages results page offers Copy link, Preview, and Download. The viewer displays text as UTF-8 and decompresses epg.gz in the browser; Copy link retains the original Pages file URL.
Release and Fork destinations are generated from the repository running the workflow. The upstream site points to Guovin/iptv-api, while a fork's site points to that user's own fork. Fork 项目 in the upstream results notice links directly to the upstream repository's Fork creation page.
If you can access this link and it returns the updated interface content, then your live source interface link has been
successfully created! Simply copy and paste this link into software like TVBox in the configuration field to use~
Note
- Run
Run workflowagain after changing templates or configuration. The Pages URLs remain unchanged. - In Actions,
open_historyonly attempts to restore short-lived cached state. A full run without history is used when that cache has expired. - Changes made by
open_auto_disable_sourceare not committed. Use another deployment method when those changes must persist. - Pages is deployed from a temporary artifact and does not write generated results to Git. Do not change it to commit a
gh-pagesbranch. - Playlist snapshots remain prereleases so they do not take the Latest label or interfere with stable GUI releases and update checks.
- Back up
config/user_config.ini,user_*.txt, custom templates, and source files from your fork. - Disable any old workflow containing
schedule; do not allow it to commitoutput/again. - Use
Sync fork→Update branch. Complete step 1 before usingDiscard commitsif conflicts require it. - Under
Settings → Pages, set the publishing source toGitHub Actions. - Run
Generate playlist manuallyand confirm both the Pages deployment and the prerelease for that run were created. - Replace legacy raw or Release URLs in players with the Pages link from the summary. The old raw URL retains only its last result and no longer updates.
-
Install Python Please download and install Python from the official website, and select the option to add Python to the system environment variable Path during installation.
-
Run the update Open the terminal CMD in the project directory and run the following commands in sequence:
Install dependencies:
pip install pipenvpipenv install --devStart the update:
pipenv run devStart the service:
pipenv run serviceThe desktop GUI for Windows and macOS provides one-click updates, live progress, channel and result management, retesting, RTMP monitoring, source configuration, and task history. Docker deployments use web result pages and do not include this desktop interface.
🌓 Toggle display mode
MainWindow connects pages to controllers. Updates run in a QThread, manual retests and screenshots use a separate queue, and the HTTP service runs in its own process. Signals, SQLite, configuration, and log files supply page state. The architecture guide maps each page to its dependencies.
Install dependencies and start it from the project directory:
pipenv install --dev
pipenv run uiBuild the desktop application for the current platform:
pipenv run ui_buildSettings are saved to config/user_config.ini; generated results, channel snapshots, task history, and logs are stored under output/. On Windows, a packaged desktop application creates both directories beside its executable by default, making them easy to back up, move, and access directly; automatic updates retain that user data. It falls back to the operating system's application-data directory only when the application directory is not writable. macOS continues to use the system application-data directory.
To choose a location in the desktop app, select Data directory on the Settings page, then restart the app; Restore default directory clears that choice. Deployment scripts can pass --data-dir when launching the application or set the IPTV_API_DATA_DIR environment variable. The command-line option takes precedence:
IPTV-API-GUI.exe --data-dir "D:\\IPTV-API Data"Install FFmpeg before enabling resolution probing. The Windows package can include nginx-rtmp. On macOS, install an nginx build with the RTMP module; the app generates and starts an isolated configuration automatically, while IPTV_API_NGINX_PATH and IPTV_API_NGINX_RTMP_MODULE can override discovery.
Warning
The legacy Tkinter interface is deprecated, retained temporarily for existing users, and scheduled for removal in a future release. It no longer receives maintenance, bug fixes, or new features. During the transition, start it with pipenv run legacy_ui or package it with pipenv run legacy_ui_build.
Download the docker-compose.yml or create one by copying the content (internal parameters can be changed as needed), then run the following command in the path where the file is located:
docker compose up -ddocker pull guovern/iptv-api:latestCaution
If the official image cannot be pulled, use the following proxy; it may provide an older image version.
docker pull docker.1ms.run/guovern/iptv-api:latestdocker run -d -p 80:8080 guovern/iptv-apiEnvironment variables:
| Variable | Description | Default |
|---|---|---|
| PUBLIC_URL | Recommended complete public URL, such as http://192.168.1.10 or https://iptv.example.com |
|
| PUBLIC_DOMAIN | Compatibility setting: public domain or IP used when PUBLIC_URL is empty |
127.0.0.1 |
| PUBLIC_PORT | Compatibility setting: mapped host port used when PUBLIC_URL is empty |
80 |
| NGINX_HTTP_PORT | Advanced compatibility setting: internal container HTTP port; normally keep the default | 8080 |
Note
When IPv6 is enabled on the host/Docker, the container automatically listens on IPv6 addresses as well, with no extra configuration; in IPv4-only or IPv6-disabled environments it is skipped automatically.
If you need to modify environment variables, add the following parameters after the above run command:
# Recommended: set the complete public URL
-e PUBLIC_URL=https://iptv.example.comWith the repository Compose file, change only the host port through PORT, for example
PORT=8088 docker compose up -d.
An unset or empty PUBLIC_URL does not override public_url in the mounted configuration.
In addition to the environment variables listed above, you can also override the configuration items in the configuration file via environment variables.
Mounts: used to synchronize files between the host and the container. You can edit templates, configs, and access generated result files directly on the host. Append the following options to the run command above:
# Mount config directory
-v /iptv-api/config:/iptv-api/config
# Mount output directory
-v /iptv-api/output:/iptv-api/output| Endpoint | Description |
|---|---|
| / | Default endpoint |
| /m3u | m3u format endpoint |
| /txt | txt format endpoint |
| /ipv4 | ipv4 default endpoint |
| /ipv6 | ipv6 default endpoint |
| /ipv4/txt | ipv4 txt endpoint |
| /ipv6/txt | ipv6 txt endpoint |
| /ipv4/m3u | ipv4 m3u endpoint |
| /ipv6/m3u | ipv6 m3u endpoint |
| /content | Endpoint content |
| /log/result | Log of valid results |
| /log/speed-test | Log of all interfaces involved in speed testing |
| /log/statistic | Log of statistics results |
| /log/unmatch | Log of unmatched channels |
RTMP Streaming:
Warning
Enabling streaming relays obtained interfaces such as subscription sources by default. Use this only for content you own, are authorized to redistribute, or need for closed/internal testing. In Mainland China, ensure content authorization, copyright, network-audiovisual, and broadcasting requirements are met; do not distribute, relay, or publicly expose unauthorized live streams or program sources.
For server deployments, set the complete public address through PUBLIC_URL; legacy PUBLIC_DOMAIN and PUBLIC_PORT remain supported. To stream local videos, create config/hls and place files named after their channels in it; the program streams them to the corresponding channels.
| Streaming Endpoint | Description |
|---|---|
| /hls | hls streaming endpoint |
| /hls/txt | hls txt streaming endpoint |
| /hls/m3u | hls m3u streaming endpoint |
| /hls/ipv4 | hls ipv4 default streaming endpoint |
| /hls/ipv6 | hls ipv6 default streaming endpoint |
| /hls/ipv4/txt | hls ipv4 txt streaming endpoint |
| /hls/ipv4/m3u | hls ipv4 m3u streaming endpoint |
| /hls/ipv6/txt | hls ipv6 txt streaming endpoint |
| /hls/ipv6/m3u | hls ipv6 m3u streaming endpoint |
| /stat | Streaming status statistics endpoint |
Docker enables streaming with minimal configuration and placing local video files in the right folder. Below are two common streaming scenarios: subscription (online) sources and local video files.
Warning
Use this only for content you are authorized to relay or for closed/internal technical testing.
The first request for /hls/{id}.m3u8 is proxied by Nginx to Flask at /hls_proxy/{id}. The service resolves the source and starts or reuses an FFmpeg stream. FFmpeg reads the online URL or local video, copies or transcodes it to RTMP, and Nginx generates HLS. Flask returns the playlist; Nginx serves TS segments directly. Idle timeouts and concurrency limits control resource use.
- Use the repository's
docker-compose.ymland confirm the following environment variables before starting:PORT: user-facing port mapped on the host.PUBLIC_URL: recommended complete public URL used to generate streaming and playlist links.NGINX_HTTP_PORT: advanced compatibility setting; normally keep the internal container port unchanged.
- Make sure the
configdirectory is mounted into the container (default/iptv-api/config) so you can edit templates, add local videos, and place subscription files on the host.
Example (excerpt from compose for reference):
services:
iptv-api:
image: guovern/iptv-api:latest
container_name: iptv-api
restart: unless-stopped
ports:
- "${PORT:-80}:8080" # PORT is user-facing; 8080 is the fixed internal container port
volumes:
- /iptv-api/config:/iptv-api/config # Change to host configuration folder path:container configuration folder path
- /iptv-api/output:/iptv-api/output
environment:
PUBLIC_URL: "${PUBLIC_URL:-http://192.168.1.95}" # Change to the complete public URL
PUBLIC_PORT: "${PORT:-80}" # Legacy compatibility value synchronized from PORT
NGINX_HTTP_PORT: "8080" # Advanced compatibility setting; normally do not change
CDN_URL: ""
# Used only for subscription sources and EPG data, not media speed tests
HTTP_PROXY: ""- Add subscription URLs (txt or m3u) to
config/subscribe.txt. On startup the program will read the subscriptions and publish streams for the channels found. - Streaming endpoints to view streamed channels:
/hls/txt,/hls/m3u(and their ipv4/ipv6 variants)
- Create an
hlsfolder under the mountedconfigdirectory (for example/iptv-api/config/hlson the host). - Put video files named exactly as the channel titles used in your template (e.g.,
海洋.mp4). The program will automatically stream the corresponding file for that channel.
Example layout:
iptv-api/
├── config
│ └── hls
│ └── 海洋.mp4
- Add the channel in
config/demo.txt(or your template) as usual; the program will map the local file to the channel and stream it.
Example template fragment:
📺Main channels,#genre#
CCTV-1
📡Satellite,#genre#
Guangdong Satellite
🚀Local video,#genre#
海洋- Start the service (example using Compose):
docker compose up -d- Verify:
- Check startup logs for successful initialization.
- View streaming results (txt): visit
/hls/txtto see current stream addresses and descriptions. - Use
/hls/m3uto load the playlist into a player or/hls/txtfor a plain list.
- Use the
/statendpoint to see current streaming counts, traffic, and basic statistics. - Container logs provide detailed stream start/stop messages:
- Logs show when a channel starts streaming and when idle channels stop.
- Public access & firewall: Make sure the HTTP port in
PUBLIC_URLand the RTMP port are externally accessible through firewalls and cloud security groups. - Domain and certificates: For HTTPS, set
PUBLIC_URLdirectly tohttps://your-domainand manage TLS through an external reverse proxy or your hosting setup. - Performance & concurrency: Local streaming consumes CPU and bandwidth. Adjust
rtmp_max_streamsto limit concurrent streams and avoid overloading the server. - Idle stop:
rtmp_idle_timeoutcontrols how long a stream stays active with no viewers (in seconds); tune it per your needs.
# RTMP channel idle stop timeout (seconds)
rtmp_idle_timeout = 300
# Maximum concurrent RTMP streams to avoid excessive server load
rtmp_max_streams = 10Above is a compact guide to using streaming. Adjust configuration and verify using /hls/* and /stat endpoints to
confirm streaming availability and status.













