'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