Last active
June 27, 2026 21:07
-
-
Save uahim/5d4ee985a5d4b90df78433a81f6b9343 to your computer and use it in GitHub Desktop.
fuck tvp - this could work when running on .pl server but I cant test it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| generates an iptv-player friendly m3u8 playlist with most tvp.pl vod channels; | |
| wont work outside of poland because of geoblocking, as of late, but MAY BE | |
| working when run on a server IN poland. | |
| */ | |
| $channels = [ | |
| '1' => 399697, | |
| '2' => 399698, | |
| 'muzyka-i-koncerty' => 2999109, | |
| 'rozrywka' => 399724, | |
| 'kultura' => 399700, | |
| 'kultura2' => 399728, | |
| 'sport' => 399702, | |
| 'kobieta' => 399701, | |
| 'nauka' => 399722, | |
| 'dokument' => 399721, | |
| 'hd' => 957439, | |
| 'seriale' => 957438, | |
| 'historia' => 399703, | |
| 'historia2' => 399725, | |
| 'milosc' => 2724087, | |
| 'info' => 399699, | |
| 'polonia' => 399723, | |
| 'world' => 399731, | |
| ]; | |
| $ch = strtolower($_GET['ch'] ?? ''); | |
| if (!isset($channels[$ch])) { | |
| echo "#EXTM3U\n"; | |
| $baseUrl = 'https://' . $_SERVER['HTTP_HOST'] . strtok($_SERVER['REQUEST_URI'], '?'); | |
| foreach ($channels as $slug => $id) { | |
| $label = ucfirst($slug); | |
| $label = preg_replace('/(?<=[a-zA-Z])2/', ' 2', $label); | |
| echo '#EXTINF:-1 tvg-id="tvp' . $slug . '" tvg-name="TVP ' . $label . '" group-title="TVP",TVP ' . $label . "\n"; | |
| echo $baseUrl . '?ch=' . $slug . "\n"; | |
| } | |
| exit; | |
| } | |
| $options = [ | |
| 'http' => [ | |
| 'method' => 'GET', | |
| 'header' => | |
| "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0\r\n" | |
| ] | |
| ]; | |
| $context = stream_context_create($options); | |
| $url = "https://vod.tvp.pl/api/products/{$channels[$ch]}/videos/playlist?videoType=MOVIE&lang=pl&platform=BROWSER"; | |
| $data = json_decode(file_get_contents($url, false, $context), true); | |
| header('Location: ' . $data['sources']['HLS'][0]['src'], true, 302); | |
| exit; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment