<?php
if (!defined('RAPIDLEECH')) {
require_once ('index.html');
exit;
}
class break_com extends DownloadClass {
public function Download($link) {
$page = $this->GetPage($link);
if (!preg_match('@sGlobalContentID\s?=\s?[\"\']?(\d+)[\"\']?@i', $page, $id)) html_error('Video ID not found.');
$page = $this->GetPage('http://api.break.com/invoke/content/' . $id[1]);
$xml = substr($page, strpos($page, "\r\n\r\n") + 4);
$xml = substr($xml, 0, strpos($xml, '<RelatedContentCollection')).substr($xml, strpos($xml, '</RelatedContentCollection>')+27);
$title = cut_str($xml, '<ContentTitle><![CDATA[', ']]></ContentTitle>');
if (empty($title)) html_error('Video Title not found.');
$badchars = '<>:"/\\|?*\'@#+~{}[]^';
$title = str_replace(str_split($badchars), '_', trim($title));
$stream = preg_match('@<SourceVideo>(https?://[^\r\n\'\"\t\s<>]+)</SourceVideo>@i', $xml, $flv) ? array(array('title' => '[FLV] Default', 'link' => $flv[1])) : array();
if (preg_match_all('@<media-content url="(https?://[^\r\n\'\"\t\s<>]+)"[^<>]+\sname="([^\"<>]+)"@i', $xml, $matches)) {
$matches = array_combine($matches[2], $matches[1]);
foreach ($matches as $vt => $vl) {
if (strtolower(strrchr($vl, '.')) == '.mp4') $vt = "[MP4] $vt";
$stream[] = array('title' => $vt, 'link' => $vl);
}
}
if (empty($stream)) html_error('Download links not found.');
elseif (count($stream) == 1) $_REQUEST['br_qs'] = 1;
$br_qs = !empty($_REQUEST['br_qs']) && $_REQUEST['br_qs'] > 0 ? $_REQUEST['br_qs'] - 1 : false;
if ($br_qs !== false) {
if (empty($stream[$br_qs])) {
$this->changeMesg(lang(300)."<br />Error: Requested video format not found, using \"{$stream[0]['title']}\".");
$dllink = $stream[0]['link'];
} else $dllink = $stream[$br_qs]['link'];
} else {
global $PHP_SELF;
echo "\n<br /><br /><h3 style='text-align: center;'>This video have more than 1 stream, please select one for download.</h4>";
echo "\n<br /><center><form name='dl' action='$PHP_SELF' method='post'>\n";
echo "<select name='br_qs' id='br_qs'>\n";
foreach ($stream as $key => $arr)
echo "<option value='".($key+1)."'>{$arr['title']}</option>\n";
echo "</select>\n";
$data = $this->DefaultParamArr($link);
foreach ( $data as $n => $v )
echo("<input type='hidden' name='$n' id='$n' value='$v' />\n");
echo "<input type='submit' name='submit' value='Download Video' />\n";
echo "</form></center>\n</body>\n</html>";
exit;
}
$ext = strrchr($dllink, '.');if (empty($ext)) $ext = '.flv';
$fname = $title . $ext;
$this->RedirectDownload($dllink, $fname, 0, 0, 0, $fname);
}
}
//[31-8-2012] Written by Th3-822.
?>
Comments