Advertisement
Th3-822

[rapidleech][d] vimeo_com

Dec 16th, 2016
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.63 KB | None | 0 0
  1. <?php
  2.  
  3. if (!defined('RAPIDLEECH')) {
  4.     require_once('index.html');
  5.     exit();
  6. }
  7.  
  8. class vimeo_com extends DownloadClass {
  9.     private $cookie = array('content_rating' => '255'), $vid, $streams;
  10.  
  11.     public function Download($link) {
  12.         if (!preg_match('@vimeo\.com/(\d+)@i', $link, $vid)) html_error('Video ID not found.');
  13.         $this->vid = $vid[1];
  14.         $this->link = $GLOBALS['Referer'] = 'https://vimeo.com/'.$this->vid;
  15.  
  16.         $page = $this->GetPage("https://player.vimeo.com/video/{$this->vid}/config", $this->cookie);
  17.         $json = $this->json2array($page);
  18.         if (!empty($json['message'])) html_error('Error: "' . htmlspecialchars($json['message'], ENT_QUOTES) . '"');
  19.  
  20.         if (empty($json['video']['title'])) html_error('Video Title not Found.');
  21.         $this->title = $json['video']['title'];
  22.  
  23.         if (empty($json['request']['files']['progressive'])) html_error('Video Streams not Found.');
  24.         $this->streams = array();
  25.         foreach ($json['request']['files']['progressive'] as $stream) $this->streams[intval($stream['quality'])] = $stream['url'];
  26.         if (empty($this->streams)) html_error('Video Streams not Found.');
  27.         krsort($this->streams, SORT_NUMERIC);
  28.  
  29.         if (count($this->streams) > 1 && empty($_POST['dlstream']) && !isset($_GET['audl'])) return $this->QSelector();
  30.         elseif (empty($_POST['dlstream']) || !empty($this->streams[intval($_POST['dlstream'])])) {
  31.             $key = (empty($_POST['dlstream']) ? key($this->streams) : intval($_POST['dlstream']));
  32.             $DL = $this->streams[$key];
  33.         } else html_error('Selected video stream was not found.');
  34.  
  35.         $filename = preg_replace('@[^ A-Za-z_\-\d\.,\(\)\[\]\{\}&\!\'\@\%\#]@u', '_', html_entity_decode(trim($this->title), ENT_QUOTES, 'UTF-8'));
  36.         $filename = preg_replace('@(?:\.(?:mp4|flv|mkv|webm|wmv|(m2)?ts|rm(vb)?|mpe?g?|vob|avi|[23]gp))+$@i', '', $filename);
  37.         $filename .= " [Vimeo-{$key}p][{$this->vid}].mp4";
  38.  
  39.         $this->RedirectDownload($DL, $filename, 0, 0, 0, $filename);
  40.     }
  41.  
  42.     private function QSelector() {
  43.         echo "\n<br /><br /><h3 style='text-align: center;'>Video Quality Selector</h4>";
  44.         echo "\n<center><form name='T8_QS' action='{$_SERVER['SCRIPT_NAME']}' method='POST'>\n";
  45.         echo "<select name='dlstream' id='QS_fmt'>\n";
  46.         foreach ($this->streams as $fmt => $url) echo "<option value='$fmt'>{$fmt}p</option>\n";
  47.         echo "</select>\n";
  48.         $data = $this->DefaultParamArr($this->link);
  49.         $data['step'] = 1;
  50.         foreach ($data as $n => $v) echo("<input type='hidden' name='$n' id='QS_$n' value='$v' />\n");
  51.         echo "<input type='submit' name='Th3-822' value='".lang(209)."' />\n";
  52.         echo "</form></center>\n";
  53.         include(TEMPLATE_DIR . 'footer.php');
  54.         exit;
  55.     }
  56. }
  57.  
  58. //[11-12-2016] Written by Th3-822.
  59.  
  60. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement