iptv-playlist-generator

0.1.5 • Public • Published

iptv-playlist-generator

It can generate IPTV playlists.

Installation

npm install iptv-playlist-generator

Usage

const generator = require('iptv-playlist-generator')
// import generator from 'iptv-playlist-generator'

const playlist = new Playlist()
playlist.header = { 'x-tvg-url': 'https://example.com/epg.xml', custom: 'value' }

const link = new Link('http://example.com/stream.m3u8')
link.title = 'CNN (1080p)'
link.attrs = {
  'tvg-id': 'CNN.us',
  'tvg-name': 'CNN',
  'tvg-url': 'http://195.154.221.171/epg/guide.xml.gz',
  'tvg-logo': 'http://example.com/logo.png',
  'group-title': 'News'
}
link.vlcOpts = {
  'http-referrer': 'http://example.com/',
  'http-user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5)'
}
playlist.links.push(link)

console.log(playlist.toString())

Output

#EXTM3U x-tvg-url="https://example.com/epg.xml" custom="value"
#EXTINF:-1 tvg-id="CNN.us" tvg-name="CNN" tvg-url="http://195.154.221.171/epg/guide.xml.gz" tvg-logo="http://example.com/logo.png" group-title="News",CNN (1080p)
#EXTVLCOPT:http-referrer=http://example.com/
#EXTVLCOPT:http-user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5)
http://example.com/stream.m3u8

Testing

npm test

Contribution

If you find a bug or want to contribute to the code or documentation, you can help by submitting an issue or a pull request.

License

MIT

Package Sidebar

Install

npm i iptv-playlist-generator

Weekly Downloads

3

Version

0.1.5

License

MIT

Unpacked Size

5.72 kB

Total Files

7

Last publish

Collaborators

  • arhey