How the Free-TV/IPTV Script Filters for Valid Channels Using the [>] Marker

The make_playlist.py script validates channels by checking if each line contains the [>] marker, skipping any line that lacks this indicator to ensure only active stream links are processed into M3U playlists.

The Free-TV/IPTV repository aggregates publicly available IPTV streams into standardized M3U playlists using a lightweight Python parser. At the heart of this pipeline is make_playlist.py, which scans Markdown tables to identify valid channel entries. The script uses a simple but effective validation mechanism to filter for the [>] marker, distinguishing actual stream links from table headers, comments, or empty rows.

The Filtering Logic in make_playlist.py

The core validation happens inside the main processing loop that iterates through Markdown files in the lists/ directory.

Line-by-Line Parsing

The script opens each markup_file and reads it line-by-line, scanning for potential channel entries embedded in Markdown table syntax. This approach allows the parser to handle large list files without loading them entirely into memory.

The [>] Marker Check

At lines 153-154 of make_playlist.py, the script performs a strict string containment check:

if "[>]" not in line:
    continue

If the line does not contain [>], the script immediately executes continue, skipping to the next iteration. Only lines containing this marker proceed to line 155, where they are parsed into a Channel object and eventually converted into M3U entries.

Why [>] Marks a Valid Channel Entry

In the repository's Markdown tables, the fourth column contains the stream URL formatted as a Markdown link with [>] as the display text:

| 1 | Some Channel | [>](https://example.com/stream.m3u8) | <img …> |

This visual cue allows editors to quickly identify active links while providing the parser with an unambiguous signal that the row represents a valid channel entry. The design keeps the parser lightweight while giving contributors a clear method for adding or removing streams without breaking the build.

From Filter to Output: Building the M3U Playlists

The Channel Object Creation

When a line passes the [>] filter, the script converts it into a structured Channel object at line 155. This object captures the stream URL, channel name, and metadata required for the M3U format, including attributes like tvg-name and tvg-logo.

Generated Playlist Files

The script produces two types of output files:

  • playlist.m3u8 – A master playlist aggregating all valid channels discovered in the lists/ directory.
  • playlists/playlist_<country>.m3u8 – Per-country playlists (e.g., playlists/playlist_italy.m3u8) that group channels by their regional markup files.

Only entries that passed the [>] validation appear in these files, ensuring broken or placeholder rows never reach the final output.

Running the Script

To generate the playlists locally and observe the filtering in action:


# Clone the repository

git clone https://github.com/Free-TV/IPTV.git
cd IPTV

# Run the playlist generator

python3 make_playlist.py

The script processes all .md files in the lists/ directory, applying the [>] filter to produce clean, validated M3U playlists containing only active stream links.

Summary

  • The make_playlist.py script filters lines by checking for the [>] marker at lines 153-154 according to the Free-TV/IPTV source code.
  • Lines without [>] are skipped via continue, while matches are parsed into Channel objects at line 155.
  • This validation ensures only active stream links from the Markdown tables enter the final playlists.
  • Output includes a master playlist.m3u8 and country-specific files in the playlists/ directory.

Frequently Asked Questions

What does the [>] marker represent in the Free-TV/IPTV repository?

The [>] marker is the display text of a Markdown link that indicates an active stream URL in the channel tables. It serves as both a visual cue for editors and a parsing signal for the make_playlist.py script to identify valid channels.

Where in the code does the [>] filtering occur?

The filtering occurs in make_playlist.py at lines 153-154, where the script checks if "[>]" not in line: and executes continue for any line that lacks the marker.

What happens to lines that don't contain [>]?

Lines without the [>] marker are automatically skipped during the parsing loop. These typically include table headers, separator lines, comments, or empty rows that do not represent actual channel streams.

How does the script handle lines that pass the [>] filter?

Lines containing [>] are passed to line 155, where they are instantiated as Channel objects and subsequently written to the appropriate M3U playlist files with proper metadata tags.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →