Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hmlendea/stream-to-m3u

Get M3U playlist links for liverstreams from various platforms
https://github.com/hmlendea/stream-to-m3u

iptv m3u m3u8

Last synced: about 2 months ago
JSON representation

Get M3U playlist links for liverstreams from various platforms

Awesome Lists containing this project

README

        

[![Donate](https://img.shields.io/badge/-%E2%99%A5%20Donate-%23ff69b4)](https://hmlendea.go.ro/fund.html) [![Build Status](https://github.com/hmlendea/stream-to-m3u/actions/workflows/dotnet.yml/badge.svg)](https://github.com/hmlendea/stream-to-m3u/actions/workflows/dotnet.yml)

# About

Tool for retrieving the M3U playlist URL for a given live stream

# Usage

The tool is used as just another console application.

Open a terminal and run the `SteamToM3U` executable, making sure that all the desired arguments are supplied.

# Configuration

The settings are supplied via CLI arguments

The following arguments are used to indicate the source of the stream

| Argument | Description |
|--------------------------------------------------------------|---------------------------------|
| --youtube
--yt | Sets the source to YouTube |
| --twitch | Sets the source to Twitch |
| --tvsporthd
--tvsport
--tvshd
--tvs | Sets the source to TV Sport HD |
| --antena-play
--antenaplay
--antena
--aplay
--ap | Sets the source to Antena Play |

If no source argument is provided, a generic solution will be attempted

Each source will require a different set of arugments to indicate the desired live stream, as follows

## YouTube

| Argument | Description | Optional |
|-----------------|------------------------------|-----------|
| --channel
-c | The host channel ID | Mandatory |
| --title
-t | The title of the live stream | Optional |

## Twitch

| Argument | Description | Optional |
|-----------------|------------------------------|-----------|
| --channel
-c | The host channel ID | Mandatory |

## TV Sport HD

| Argument | Description | Optional |
|-----------------|------------------------------|-----------|
| --channel
-c | The host channel ID | Mandatory |

## Antena Play

| Argument | Description | Optional |
|-----------------|------------------------------|-----------|
| --channel
-c | The host channel ID | Mandatory |

## Other

| Argument | Description | Optional |
|-------------|---------------------------------------------------|-----------|
| --url
-u | The URL of the page that contains the live stream | Mandatory |

## Running in background as a service

**Note:** The following instructions only apply for *Linux* distributions using *systemd*.

Create the following service file: /usr/lib/systemd/system/[email protected]
```
[Unit]
Description=Stream to M3U (%i channels)

[Service]
WorkingDirectory=[ABSOLUTE_PATH_TO_SERVICE_DIRECTORY]
ExecStart=[ABSOLUTE_PATH_TO_SERVICE_DIRECTORY]/StreamToM3U -i [ABSOLUTE_PATH_TO_SERVICE_DIRECTORY]/Data/input-%i.xml -O /srv/http/iptv/livestreams/%i -u http://mydomain.com/iptv
MemoryAccounting=yes
MemoryMax=256M

[Install]
WantedBy=multi-user.target
```

Create the following timer file: /lib/systemd/system/stream-to-m3u.timer
```
[Unit]
Description=Periodically creates an M3U playlist out of livestreams (%i channels)

[Timer]
OnBootSec=3min
OnUnitActiveSec=40min

[Install]
WantedBy=timers.target
```

Values that you might want to change:
- *OnBootSec*: the delay before the service is started after the OS is booted
- *OnUnitActiveSec*: how often the service will be triggered
- *MemoryMax*: RAM usage limit

In the above example, the service will start 3 minutes after boot, and then again once every 40 minutes, being allocated 256M RAM per instance