Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined('RAPIDLEECH')) {
- require_once('index.html');
- exit();
- }
- class vimeo_com extends DownloadClass {
- private $cookie = array('content_rating' => '255'), $vid, $streams;
- public function Download($link) {
- if (!preg_match('@vimeo\.com/(\d+)@i', $link, $vid)) html_error('Video ID not found.');
- $this->vid = $vid[1];
- $this->link = $GLOBALS['Referer'] = 'https://vimeo.com/'.$this->vid;
- $page = $this->GetPage("https://player.vimeo.com/video/{$this->vid}/config", $this->cookie);
- $json = $this->json2array($page);
- if (!empty($json['message'])) html_error('Error: "' . htmlspecialchars($json['message'], ENT_QUOTES) . '"');
- if (empty($json['video']['title'])) html_error('Video Title not Found.');
- $this->title = $json['video']['title'];
- if (empty($json['request']['files']['progressive'])) html_error('Video Streams not Found.');
- $this->streams = array();
- foreach ($json['request']['files']['progressive'] as $stream) $this->streams[intval($stream['quality'])] = $stream['url'];
- if (empty($this->streams)) html_error('Video Streams not Found.');
- krsort($this->streams, SORT_NUMERIC);
- if (count($this->streams) > 1 && empty($_POST['dlstream']) && !isset($_GET['audl'])) return $this->QSelector();
- elseif (empty($_POST['dlstream']) || !empty($this->streams[intval($_POST['dlstream'])])) {
- $key = (empty($_POST['dlstream']) ? key($this->streams) : intval($_POST['dlstream']));
- $DL = $this->streams[$key];
- } else html_error('Selected video stream was not found.');
- $filename = preg_replace('@[^ A-Za-z_\-\d\.,\(\)\[\]\{\}&\!\'\@\%\#]@u', '_', html_entity_decode(trim($this->title), ENT_QUOTES, 'UTF-8'));
- $filename = preg_replace('@(?:\.(?:mp4|flv|mkv|webm|wmv|(m2)?ts|rm(vb)?|mpe?g?|vob|avi|[23]gp))+$@i', '', $filename);
- $filename .= " [Vimeo-{$key}p][{$this->vid}].mp4";
- $this->RedirectDownload($DL, $filename, 0, 0, 0, $filename);
- }
- private function QSelector() {
- echo "\n<br /><br /><h3 style='text-align: center;'>Video Quality Selector</h4>";
- echo "\n<center><form name='T8_QS' action='{$_SERVER['SCRIPT_NAME']}' method='POST'>\n";
- echo "<select name='dlstream' id='QS_fmt'>\n";
- foreach ($this->streams as $fmt => $url) echo "<option value='$fmt'>{$fmt}p</option>\n";
- echo "</select>\n";
- $data = $this->DefaultParamArr($this->link);
- $data['step'] = 1;
- foreach ($data as $n => $v) echo("<input type='hidden' name='$n' id='QS_$n' value='$v' />\n");
- echo "<input type='submit' name='Th3-822' value='".lang(209)."' />\n";
- echo "</form></center>\n";
- include(TEMPLATE_DIR . 'footer.php');
- exit;
- }
- }
- //[11-12-2016] Written by Th3-822.
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement