• Vítejte na XBMC-Kodi.cz
  • Česko-slovenská komunita fanoušků XBMC/Kodi
Vítejte návštevníku! Přihlášení Registrace


Hodnocení tématu:
  • 10 Hlas(ů) - 2.4 Průměr
  • 1
  • 2
  • 3
  • 4
  • 5
OTT/IPTV - jednodušeji to už nejde
iVysílání ČT
PHP skript (index.php):
Kód:
<?php
#params
$channel_input = explode(".m3u8", $_GET["ch"]);
$channel_input = $channel_input[0];

#token
$ch = curl_init('https://www.ceskatelevize.cz/services/ivysilani/xml/token/');
$post = ['user' => 'iDevicesMotion'];
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'User-Agent: iVysilani/Android', 'Host: www.ceskatelevize.cz'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$token = strval(simplexml_load_string($result)[0]);

#keyurl
$ch = curl_init('https://www.ceskatelevize.cz/services/ivysilani/xml/playlisturl/');
$post = ['quality' => 'web', 'playerType' => 'iPad', 'token' => $token, 'ID' => 'CT'.$channel_input, 'playlistType' => 'json'];
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('User-Agent: okhttp/2.7.0', 'Host: www.ceskatelevize.cz', 'Connection: Keep-Alive', 'Accept-Ecoding: gzip', 'Content-type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$keyurl = strval(simplexml_load_string($result)[0]);

#stream
$ch = curl_init($keyurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('User-Agent: okhttp/2.7.0', 'Host: www.ceskatelevize.cz', 'Connection: Keep-Alive', 'Accept-Ecoding: gzip', 'Content-type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
header('Content-Type: text/plain; charset=utf-8');
$data = json_decode($result,true);
$url = strval($data['playlist'][0]['streamUrls']['main']);
header('Location: '.$url.'');
?>
.htaccess:
Kód:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /CT/index.php?ch=$1 [L,QSA]

Oba soubory do složky "CT" a url streamu pak bude:
Kód:
http://tvujweb.cz/CT/28
Nebo s koncovkou:
Kód:
http://tvujweb.cz/CT/28.m3u8
Nebo bez použití htaccess:
Kód:
http://tvujweb.cz/CT/index.php?ch=28
Kanály o kterých vím: 25, 26, 27, 28, 29, 30, 31, 32
 
Citovat
  


Příspěvků v tématu
OTT/IPTV - jednodušeji to už nejde - od Saros - 24.1.2021, 19:13

Přejít na fórum:


Prochází: 3 host(ů)