Advertisement
Th3-822

[rapidleech][d] break.com

Aug 31st, 2012
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.68 KB | None | 0 0
  1. <?php
  2.  
  3. if (!defined('RAPIDLEECH')) {
  4.     require_once ('index.html');
  5.     exit;
  6. }
  7.  
  8. class break_com extends DownloadClass {
  9.     public function Download($link) {
  10.         $page = $this->GetPage($link);
  11.  
  12.         if (!preg_match('@sGlobalContentID\s?=\s?[\"\']?(\d+)[\"\']?@i', $page, $id)) html_error('Video ID not found.');
  13.  
  14.         $page = $this->GetPage('http://api.break.com/invoke/content/' . $id[1]);
  15.         $xml = substr($page, strpos($page, "\r\n\r\n") + 4);
  16.         $xml = substr($xml, 0, strpos($xml, '<RelatedContentCollection')).substr($xml, strpos($xml, '</RelatedContentCollection>')+27);
  17.  
  18.         $title = cut_str($xml, '<ContentTitle><![CDATA[', ']]></ContentTitle>');
  19.         if (empty($title)) html_error('Video Title not found.');
  20.         $badchars = '<>:"/\\|?*\'@#+~{}[]^';
  21.         $title = str_replace(str_split($badchars), '_', trim($title));
  22.  
  23.         $stream = preg_match('@<SourceVideo>(https?://[^\r\n\'\"\t\s<>]+)</SourceVideo>@i', $xml, $flv) ? array(array('title' => '[FLV] Default', 'link' => $flv[1])) : array();
  24.         if (preg_match_all('@<media-content url="(https?://[^\r\n\'\"\t\s<>]+)"[^<>]+\sname="([^\"<>]+)"@i', $xml, $matches)) {
  25.             $matches = array_combine($matches[2], $matches[1]);
  26.             foreach ($matches as $vt => $vl) {
  27.                 if (strtolower(strrchr($vl, '.')) == '.mp4') $vt = "[MP4] $vt";
  28.                 $stream[] = array('title' => $vt, 'link' => $vl);
  29.             }
  30.         }
  31.  
  32.         if (empty($stream)) html_error('Download links not found.');
  33.         elseif (count($stream) == 1) $_REQUEST['br_qs'] = 1;
  34.  
  35.         $br_qs = !empty($_REQUEST['br_qs']) && $_REQUEST['br_qs'] > 0 ? $_REQUEST['br_qs'] - 1 : false;
  36.         if ($br_qs !== false) {
  37.             if (empty($stream[$br_qs])) {
  38.                 $this->changeMesg(lang(300)."<br />Error: Requested video format not found, using \"{$stream[0]['title']}\".");
  39.                 $dllink = $stream[0]['link'];
  40.             } else $dllink = $stream[$br_qs]['link'];
  41.         } else {
  42.             global $PHP_SELF;
  43.  
  44.             echo "\n<br /><br /><h3 style='text-align: center;'>This video have more than 1 stream, please select one for download.</h4>";
  45.             echo "\n<br /><center><form name='dl' action='$PHP_SELF' method='post'>\n";
  46.             echo "<select name='br_qs' id='br_qs'>\n";
  47.             foreach ($stream as $key => $arr)
  48.                 echo "<option value='".($key+1)."'>{$arr['title']}</option>\n";
  49.             echo "</select>\n";
  50.             $data = $this->DefaultParamArr($link);
  51.             foreach ( $data as $n => $v )
  52.                 echo("<input type='hidden' name='$n' id='$n' value='$v' />\n");
  53.             echo "<input type='submit' name='submit' value='Download Video' />\n";
  54.             echo "</form></center>\n</body>\n</html>";
  55.             exit;
  56.         }
  57.  
  58.         $ext = strrchr($dllink, '.');if (empty($ext)) $ext = '.flv';
  59.         $fname = $title . $ext;
  60.  
  61.         $this->RedirectDownload($dllink, $fname, 0, 0, 0, $fname);
  62.     }
  63. }
  64.  
  65. //[31-8-2012]  Written by Th3-822.
  66.  
  67. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement