Registry / data / iptv-playlist-parser

iptv-playlist-parser

JSON →
library0.15.2jsnpmunverified

iptv-playlist-parser is a utility designed to parse M3U and M3U8 IPTV playlists into a structured JavaScript object format. It is currently at version 0.15.2 and actively maintained, with frequent small releases addressing bug fixes and minor improvements rather than a strict release cadence. The library aims to provide a straightforward way to extract program information, group titles, TVG attributes (ID, name, URL, logo, shift), and HTTP options (referrer, user-agent) from raw playlist data. Its primary differentiator is its focused utility for IPTV playlist formats, providing a normalized output structure for consumption in applications that need to process and display IPTV channel listings. It is a lightweight solution without external runtime dependencies, relying on standard Node.js modules for file and URL operations.

npm install iptv-playlist-parser
INSTALL
IMPORT
SIG · IPTV-PLAYLIST-PARS
I
iptv-playlist-parser
datajavascriptv0.15.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse
import { parse } from 'iptv-playlist-parser'
import parser from 'iptv-playlist-parser'
The library primarily exports a `parse` function as a named export, not a default export, despite some README examples suggesting otherwise.
parse
const { parse } = require('iptv-playlist-parser')
const parser = require('iptv-playlist-parser')
For CommonJS, destructure the `parse` function directly. The module object itself is not the parser function.

Demonstrates parsing a raw M3U playlist string and logging the structured JavaScript object output, including header and item details.

import { parse } from 'iptv-playlist-parser' const playlistString = `#EXTM3U x-tvg-url="http://example.com/epg.xml.gz" #EXTINF:-1 tvg-id="cnn.us" tvg-name="CNN" tvg-url="http://195.154.221.171/epg/guide.xml.gz" tvg-shift="-4.5" timeshift="3" catchup="shift" catchup-days="3" catchup-source="https://m3u-server/hls-apple-s4-c494-abcdef.m3u8?utc=325234234&lutc=3123125324" lang="eng" tvg-logo="http://example.com/logo.png" group-title="News",CNN (US) #EXTGRP:News #EXTVLCOPT:http-referrer=http://example.com/ #EXTVLCOPT:http-user-agent=Mozilla/5.0 (Macintosh; Intel OS X 10_14_5) http://example.com/stream.m3u8` const parsedResult = parse(playlistString) console.log(JSON.stringify(parsedResult, null, 2)) /* Expected Output: { "header": { "attrs": { "x-tvg-url": "http://example.com/epg.xml.gz" }, "raw": "#EXTM3U x-tvg-url=\"http://example.com/epg.xml.gz\"" }, "items": [ { "name": "CNN (US)", "tvg": { "id": "cnn.us", "name": "CNN", "url": "http://195.154.221.171/epg/guide.xml.gz", "logo": "http://example.com/logo.png", "rec": "", "shift": "-4.5" }, "group": { "title": "News" }, "http": { "referrer": "http://example.com/", "user-agent": "Mozilla/5.0 (Macintosh; Intel OS X 10_14_5)" }, "url": "http://example.com/stream.m3u8", "raw": "#EXTINF:-1 tvg-id=\"cnn.us\" tvg-name=\"CNN\" tvg-url=\"http://195.154.221.171/epg/guide.xml.gz\" tvg-shift=\"-4.5\" timeshift=\"3\" catchup=\"shift\" catchup-days=\"3\" catchup-source=\"https://m3u-server/hls-apple-s4-c494-abcdef.m3u8?utc=325234234&lutc=3123125324\" tvg-logo=\"http://example.com/logo.png\" group-title=\"News\",CNN (US)\n#EXTGRP:News\n#EXTVLCOPT:http-referrer=http://example.com/\n#EXTVLCOPT:http-user-agent=Mozilla/5.0 (Macintosh; Intel OS X 10_14_5)\nhttp://example.com/stream.m3u8", "line": 2, "timeshift": "3", "catchup": { "type": "shift", "source": "https://m3u-server/hls-apple-s4-c494-abcdef.m3u8?utc=325234234&lutc=3123125324", "days": "3" }, "lang": "eng" } ] } */
Debug
Known issues
breakingSupport for `tvg-language` and `tvg-country` attributes was completely removed, meaning these attributes will no longer be parsed or included in the output object.
fix
Migrate any logic relying on `tvg-language` or `tvg-country` attributes to use alternative properties or external data sources.
affects: >=0.12.0
gotchaPrior to v0.15.0, links containing headers embedded in the URL (e.g., `url|Header=Value`) might not have been stored in their original, unparsed form in the `url` property. The behavior changed to preserve the original URL string.
fix
If your application relied on the `url` property being stripped of embedded headers in older versions, adjust your parsing logic or update to v0.15.0+ and process the `url` property as needed.
affects: <0.15.0
gotchaThe `http.referrer` property was incorrectly missing from the result object in versions prior to 0.15.1, even if present in the playlist. It is now correctly parsed and included.
fix
Update to version 0.15.1 or later to ensure `http.referrer` is correctly parsed. If on older versions, manual parsing would have been required.
affects: <0.15.1
Errors
Common errors & fixes
ReferenceError: parse is not defined
Incorrect import statement; attempting to use `parse` when it hasn't been correctly imported (e.g., using `import parser from '...'` instead of named import `import { parse } from '...'`).
fix
For ES Modules, use `import { parse } from 'iptv-playlist-parser'`. For CommonJS, use `const { parse } = require('iptv-playlist-parser')`.
Malformed output when channel name contains a comma
A bug in earlier versions incorrectly parsed `EXTINF` lines when the channel name itself contained a comma.
fix
Upgrade to version 0.12.2 or newer to resolve this parsing issue.
Some links containing accents are omitted or incorrectly parsed
A bug in earlier versions caused links with accented characters to be incorrectly handled or ignored during parsing.
fix
Upgrade to version 0.12.1 or newer to fix the issue with links containing accents.
Incorrect parsing of CRLF line endings leading to malformed results
Prior to v0.15.2, the parser had issues correctly handling Windows-style CRLF (Carriage Return Line Feed) line endings, potentially leading to incomplete or incorrect parsing.
fix
Update to version 0.15.2 or newer to ensure correct handling of all common line ending formats.
Upgrade
Version history
0.15.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Amazon
1
Resources
iptv-playlist-parser — npm install iptv-playlist-parser · libregistry