Naskrobane coś na szybko w php'ie. W kodzie ścieżka domyślna dla vlc. Uruchamiane spod cmd.
php.exe telewizjada.php idKanału
czyli np. dla tvp2
php.exe telewizjada.php 2
Code: Select all
<?php
$id = $argv[1];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://telewizjada.net/get_mainchannel.php");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, "cid=" . $id);
curl_setopt($curl, CURLOPT_POSTREDIR, 3);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($curl);
$channel = json_decode($json,true);
curl_setopt($curl, CURLOPT_URL, "http://telewizjada.net/set_cookie.php");
curl_setopt($curl, CURLOPT_POSTFIELDS, "url=" . $channel['url']);
curl_setopt($curl, CURLOPT_HEADER, 1);
$response = curl_exec($curl);
$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
$header = substr($response, 0, $header_size);
$header = explode('sessid=',$header);
$sessid = substr($header[1],0,26);
$header = explode('msec=', $header[1]);
$header = explode(';',$header[1]);
$msec = $header[0];
curl_close($curl);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://telewizjada.net/get_channel_url.php");
curl_setopt($curl, CURLOPT_COOKIE, 'cb-enabled=enabled; sessid=' . $sessid . '; msec=' . $msec);
curl_setopt($curl, CURLOPT_POSTFIELDS, "cid=" . $id);
curl_setopt($curl, CURLOPT_USERAGENT,'User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36');
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTREDIR, 3);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($curl);
$playpath = json_decode($json,true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($curl, CURLOPT_URL, $playpath['url']);
$plik = curl_exec($curl);
curl_close($curl);
$serwer = explode('playlist', $playpath['url']);
$plik = explode('chunklist', $plik);
$playpath = $serwer[0] . 'chunklist' . $plik[1];
$cmd = '"C:\Program Files\VideoLAN\VLC\vlc.exe" ' . $playpath;
shell_exec ($cmd);
?>