Small bug fix.
[PyMotherless.git] / beeg-dl.php
blobaf2b48a2614264191130ae8ed732221b8c2c66a7
1 <?php
2 @ob_start();
3 if(!isset($_GET['act'])) { $_GET['act'] = "url"; }
4 if($_GET['act']=="download") { $_GET['act'] = "get"; }
5 if($_GET['act']=="view") { $_GET['act'] = "get"; }
6 if($_GET['act']=="geturl") { $_GET['act'] = "url"; }
7 if($_GET['act']=="viewurl") { $_GET['act'] = "url"; }
8 if($_GET['act']=="redir") { $_GET['act'] = "goto"; }
9 if($_GET['act']=="redirect") { $_GET['act'] = "goto"; }
10 if($_GET['act']=="location") { $_GET['act'] = "goto"; }
11 if($_GET['act']=="gourl") { $_GET['act'] = "goto"; }
12 if($_GET['act']=="gotourl") { $_GET['act'] = "goto"; }
13 $default_opts = array(
14 'http'=>array(
15 'method'=>"GET",
16 'header'=>"User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0\r\n".
17 "Referer: http://beeg.com/".$_GET['v']."\r\n"
20 $default = stream_context_set_default($default_opts);
21 if($_GET['act']=="url") {
22 header("Content-type: text/plain; charset=utf-8");
23 $get_value = file_get_contents("http://beeg.com/".$_GET['v']);
24 $preg_grep_1 = preg_quote("'file': '");
25 $preg_grep_2 = preg_quote("',");
26 preg_match("/".$preg_grep_1."(.*)".$preg_grep_2."/", $get_value, $get_value_matches);
27 $get_value = $get_value_matches[1]."?start=0";
28 $get_value = trim($get_value);
29 echo $get_value; }
30 if($_GET['act']=="goto") {
31 header("Content-type: text/plain; charset=utf-8");
32 $get_value = file_get_contents("http://beeg.com/".$_GET['v']);
33 $preg_grep_1 = preg_quote("'file': '");
34 $preg_grep_2 = preg_quote("',");
35 preg_match("/".$preg_grep_1."(.*)".$preg_grep_2."/", $get_value, $get_value_matches);
36 $get_value = $get_value_matches[1]."?start=0";
37 $get_value = trim($get_value);
38 header("Location: ".$get_value);
39 echo $get_value; }
40 if($_GET['act']=="get") {
41 $get_value = file_get_contents("http://beeg.com/".$_GET['v']);
42 $preg_grep_1 = preg_quote("'file': '");
43 $preg_grep_2 = preg_quote("',");
44 preg_match("/".$preg_grep_1."(.*)".$preg_grep_2."/", $get_value, $get_value_matches);
45 $get_value = $get_value_matches[1]."?start=0";
46 $get_value = trim($get_value);
47 $getvidheaders = get_headers($get_value, 1);
48 header("Content-Type: ".$getvidheaders['Content-Type']);
49 echo file_get_contents($get_value); }