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
muslnode 18–226 runs
build_error
glibcnode 18–226 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"
}
]
}
*/
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 '...'`).
fixFor 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.
fixUpgrade 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.
fixUpgrade 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.
fixUpdate to version 0.15.2 or newer to ensure correct handling of all common line ending formats.
Audit
Dependencies
No dependency data recorded yet.