echo $str; } } function qprintf($format, $param, $arg) { global $cli; if (!$cli->getParam('quiet')) { printf($format, $param, $arg); } } // Global code starts here /*$header = "\nKSV WeebTV Downloader\n\n"; $format = "%-8s : %s\n"; $ChannelFormat = "%2d) %-22.22s"; strncasecmp(php_uname('s'), "Win", 3) == 0 ? $windows = true : $windows = false; if ($windows) { if (file_exists("C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe")) $vlc = "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe"; else $vlc = "C:\\Program Files\\VideoLAN\\VLC\\vlc.exe"; } else $vlc = "vlc";*/ $cli = new CLI(); $cc = new cURL(); ReadSettings(); LogIn(); ShowChannel($url);
} else { $html = GetHtmlResponse($cc, "http://weeb.tv/channels/live"); preg_match('/<ul class="channels">(.*?)<\\/ul>/is', $html, $html); $html = $html[1]; preg_match_all('/<fieldset[^>]+>(.*?)<\\/fieldset>/is', $html, $fieldSets); foreach ($fieldSets[1] as $fieldSet) { preg_match('/12px.*?<a href="([^"]+)"[^>]+>(.*?)<\\/a>/i', $fieldSet, $channelVars); $ChannelList[$channelVars[2]] = $channelVars[1]; } uksort($ChannelList, 'strnatcasecmp'); $FirstRun = true; $KeepRunning = true; while ($KeepRunning) { if ($FirstRun) { $FirstRun = false; } else { ShowHeader(); } Display($ChannelList, $ChannelFormat, 3); printf("Enter Channel Number : "); $channel = trim(fgets(STDIN)); if (is_numeric($channel) && $channel >= 1 && $channel <= count($ChannelList)) { $url = $ChannelList[KeyName($ChannelList, $channel - 1)]; $filename = KeyName($ChannelList, $channel - 1); ShowChannel($url, $filename); } else { $KeepRunning = false; } } } Close("Finished");