forked from MefhigosetH/vikeep
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstream.php
More file actions
70 lines (58 loc) · 2.36 KB
/
Copy pathstream.php
File metadata and controls
70 lines (58 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/************************
File: stream.php
Date: 2015-01-22
Brief: Viki streams download resource.
Legal notice:
Vikeep. Keep viki.com videos, yours.
Copyright (C) 2013 Victor Villarreal <mefhigoseth@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
************************/
include('inc/functions.inc.php');
include('inc/viki.inc.php');
if( isset($_GET['id']) && isset($_GET['quality']) ) {
$viki = new vikiAPI();
$vikiStreams = $viki->streams($_GET['id']);
$count = count($vikiStreams);
if( $count ) {
if( isset($vikiStreams[$_GET['quality']]) ) {
$url = $vikiStreams[$_GET['quality']]['http']['url'];
$ch = @curl_init();
@curl_setopt($ch, CURLOPT_URL, $url);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, FALSE);
@curl_setopt($ch, CURLOPT_NOBODY, TRUE);
//curl_setopt($ch, CURLOPT_HEADER, FALSE);
@curl_exec($ch);
$info = @curl_getinfo($ch);
@curl_close($ch);
@header("Cache-Control: no-cache, must-revalidate");
@header("Pragma: no-cache");
@header("Content-Disposition: attachment; filename= ".$_GET['id']."-".$_GET['quality'].".mp4");
@header("Content-Type: ".$info['content_type']);
@header("Content-Transfer-Encoding: binary");
@header("Content-Length: ".$info['download_content_length']);
$fp = fopen($url,"rb");
if(ob_get_length() > 0) { ob_end_clean(); }
@fpassthru($fp);
fclose($fp);
exit;
}
}
else {
echo "Error: No available streams for episode ID ".$_GET['id'];
}
}
else {
echo "Error: Episode ID or Quality not set.";
}
?>