PageRenderTime 40ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/filme/php/10starmovies_link1.php

https://code.google.com/p/hdforall/
PHP | 370 lines | 368 code | 0 blank | 2 comment | 4 complexity | e953a060604ea83a9f36be3cde2a79e4 MD5 | raw file
  1. #!/usr/local/bin/Resource/www/cgi-bin/php
  2. <?php
  3. error_reporting(0);
  4. $filelink = $_GET["file"];
  5. $filelink=urldecode($filelink);
  6. function str_between($string, $start, $end){
  7. $string = " ".$string; $ini = strpos($string,$start);
  8. if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini;
  9. return substr($string,$ini,$len);
  10. }
  11. function str_prep($string){
  12. $string = str_replace(' ','%20',$string);
  13. $string = str_replace('[','%5B',$string);
  14. $string = str_replace(']','%5D',$string);
  15. $string = str_replace('%3A',':',$string);
  16. $string = str_replace('%2F','/',$string);
  17. $string = str_replace('#038;','',$string);
  18. $string = str_replace('&amp;','&',$string);
  19. return $string;
  20. }
  21. function cv($s) {
  22. $g=ord("g");
  23. $c=ord($s);
  24. if ($c < 58) {
  25. $c=$s;
  26. } else {
  27. $c=$c-$g + 16;
  28. }
  29. return $c;
  30. }
  31. function vix($k,$char_rep,$pos_link,$h,$fn) {
  32. $f=explode("return p}",$h);
  33. $e=explode("'.split",$f[$k]);
  34. $ls=$e[0];
  35. preg_match("/(\|)((s|w)\d{2})\|/",$ls,$m);
  36. $server=$m[2];
  37. preg_match("/(\|)([a-z0-9]{45})\|/",$ls,$m);
  38. $hash=$m[2];
  39. preg_match("/(\|)(182|384|364)\|/",$ls,$m);
  40. $port=$m[2];
  41. preg_match("/(\|)(divxden|vidxden)\|/",$ls,$m);
  42. $serv_name=$m[2];
  43. $r="http://".$server.".".$serv_name.".com:".$port."/d/".$hash."/".$fn;
  44. return $r;
  45. }
  46. function get_unpack($k,$char_rep,$pos_link,$h) {
  47. $g=ord("g");
  48. $f=explode("return p}",$h);
  49. $e=explode("'.split",$f[$k]);
  50. $t=$e[0];
  51. $a=explode(";",$t);
  52. //print_r($a); //for debug only
  53. $w=explode("|",$a[$char_rep]); //char list for replace
  54. $t1=explode("'",$a[$pos_link]); // where is final link
  55. $fl= $t1[3];
  56. $s1=explode("/",$fl);
  57. $r="";
  58. for ($i=0;$i<strlen($fl)-1;$i++) {
  59. if (preg_match("/[A-Za-z0-9_]/",$fl[$i])) {
  60. $m=$w[cv($fl[$i])];
  61. if ($m=="") $m=$fl[$i];
  62. $r=$r.$m;
  63. } else {
  64. $r=$r.$fl[$i];
  65. }
  66. }
  67. return $r;
  68. }
  69. function rapidmov($string) {
  70. $h = file_get_contents($string);
  71. $g=ord("g");
  72. $f=explode("return p}",$h);
  73. $e=explode("'.split",$f[1]);
  74. $t=$e[0];
  75. $a=explode(";",$t);
  76. $w=explode("|",$a[9]);
  77. $t1=explode("'",$a[4]);
  78. $fl= $t1[3];
  79. $s1=explode("/",$fl);
  80. $r="";
  81. for ($i=0;$i<strlen($fl)-1;$i++) {
  82. if (preg_match("/[A-Za-z0-9_]/",$fl[$i])) {
  83. $r=$r.$w[cv($fl[$i])];
  84. } else {
  85. $r=$r.$fl[$i];
  86. }
  87. }
  88. return $r;
  89. }
  90. function videobb($l) {
  91. $ch = curl_init();
  92. curl_setopt($ch, CURLOPT_URL, $l);
  93. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  94. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
  95. curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
  96. curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt');
  97. curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
  98. $page = curl_exec($ch);
  99. curl_close($ch);
  100. preg_match_all('/\{"d":(false|true),"l":"([^"]+)","u":"([^"]+)"\}/i', $page, $st);
  101. $stream = array();
  102. for ($i = 0; $i < count($st[0]); $i++) {
  103. $stream[$st[2][$i]] = array(($st[1][$i] == "true" ? true : false), base64_decode($st[3][$i]));
  104. }
  105. if (count($stream) > 1) {
  106. foreach ($stream as $st => $da) {
  107. if ($da[0] == true) {
  108. $fl=$da[1];
  109. } else {
  110. $fl=$da[1]; // ?????
  111. }
  112. }
  113. } else {
  114. $qs = array_rand($stream);
  115. $fl = $stream[$qs][1];
  116. }
  117. return $fl;
  118. }
  119. function vk($string) {
  120. if (strpos($string,"video_ext.php") === false) {
  121. $h = file_get_contents($string);
  122. $t1=explode("nvar vars",$h);
  123. $l=$t1[1];
  124. $uid=str_between($l,'\"uid\":\"','\"');
  125. $host=str_between($l,'"host\":\"','\"');
  126. $host=str_replace("\\/","/",$host);
  127. $host=str_replace("\\/","/",$host);
  128. $host=str_replace("\/","/",$host);
  129. $vtag=str_between($l,'"vtag\":\"','\"');
  130. $r=$host."u".$uid."/video/".$vtag.".360.mp4";
  131. } else {
  132. $baza = file_get_contents($string);
  133. $host = str_between($baza,"var video_host = '","'");
  134. $uid = str_between($baza,"var video_uid = '","'");
  135. $vtag = str_between($baza,"var video_vtag = '","'");
  136. $hd = str_between($baza,"var video_max_hd = '","'");
  137. $r = $host."u".$uid."/video/".$vtag.".360.mp4";
  138. if ($hd == "0") {
  139. $r = $host."u".$uid."/video/".$vtag.".240.mp4";
  140. }
  141. }
  142. return $r;
  143. }
  144. function youtube($file) {
  145. if(preg_match('/youtube\.com\/(v\/|watch\?v=|embed\/)([\w\-]+)/', $file, $match)) {;
  146. $l ="http://www.youtube.com/watch?v=".$match[2];
  147. $r=file_get_contents("http://127.0.0.1/cgi-bin/scripts/util/yt.php?file=".$l);
  148. }
  149. return $r;
  150. }
  151. function flvz($string) {
  152. if (strpos($string,"embed") === false) {
  153. $string=str_replace("video","embed",$string);
  154. }
  155. $h = file_get_contents($string);
  156. $r = str_between($h,'"url": "','"');
  157. return $r;
  158. }
  159. function putlocker($string) {
  160. $id=substr(strrchr($string,"/"),1);
  161. $ch = curl_init();
  162. curl_setopt($ch, CURLOPT_URL, $string);
  163. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  164. curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt');
  165. curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
  166. $h = curl_exec($ch);
  167. curl_close($ch);
  168. $t1=explode('form method="post"',$h);
  169. $t2=explode('value="',$t1[1]);
  170. $t3=explode('"',$t2[1]);
  171. $hash=$t3[0];
  172. $post="hash=".$hash."&confirm=Close+Ad+and+Watch+as+Free+User";
  173. $ch = curl_init();
  174. curl_setopt($ch, CURLOPT_URL, $string);
  175. curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
  176. curl_setopt ($ch, CURLOPT_POST, 1);
  177. curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
  178. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  179. curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
  180. $h = curl_exec($ch);
  181. curl_close($ch);
  182. if (strpos($string,"putlocker") !==false) {
  183. $url="http://www.putlocker.com/get_file.php?embed_stream=".$id;
  184. } elseif (strpos($string,"sockshare") !==false) {
  185. $url="http://www.sockshare.com/get_file.php?embed_stream=".$id;
  186. }
  187. $ch = curl_init();
  188. curl_setopt($ch, CURLOPT_URL, $url);
  189. curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
  190. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  191. $h = curl_exec($ch);
  192. curl_close($ch);
  193. $t1=explode('media:content url="',$h);
  194. $t2=explode('"',$t1[2]);
  195. $r = $t2[0];
  196. return $r;
  197. }
  198. function megavideo($string) {
  199. if (preg_match('/(v=)([A-Za-z0-9_]+)/', $string, $m)) {
  200. $id=$m[2];
  201. } elseif (preg_match('/(v\/)([A-Za-z0-9_]+)/', $string, $m)) {
  202. $file = get_headers($string);
  203. foreach ($file as $key => $value) {
  204. if (strstr($value,"location")) {
  205. $url = ltrim($value,"location: ");
  206. $id = substr(strrchr($url, '='),1);
  207. } // end if
  208. } // end foreach
  209. } elseif (preg_match('/(d=)([A-Za-z0-9_]+)/', $string, $m)) {
  210. $h=file_get_contents($string);
  211. $id=str_between($h,'flashvars.v = "','"');
  212. }
  213. return $id;
  214. }
  215. function megavideo_premium($megavideo_id) {
  216. if ($MEGA_COOKIE <> "") {
  217. //Get megavideo original link download
  218. $link = "http://www.megavideo.com/xml/player_login.php?u=". $MEGA_COOKIE . "&v=" . $megavideo_id;
  219. $content = file_get_contents($link);
  220. //Check for premium account
  221. if( strstr($content, 'type="premium"') ) {
  222. //Get direct download link
  223. $downloadurl = strstr($content, "downloadurl=");
  224. $downloadurl = substr($downloadurl, 13, strpos($downloadurl,'" ')-13 );
  225. if($downloadurl) {
  226. $downloadurl = urldecode($downloadurl);
  227. $downloadurl = html_entity_decode($downloadurl);
  228. return $downloadurl ;
  229. }
  230. }
  231. }
  232. }
  233. //***************Here we start**************************************
  234. $filelink=str_prep($filelink);
  235. $h1=file_get_contents($filelink);
  236. $t1=explode('href="',$h1);
  237. $t2=explode('"',$t1[1]);
  238. $filelink=$t2[0];
  239. if ((strpos($filelink,"vidxden") !==false) || (strpos($filelink,"divxden") !==false)) {
  240. $fname=substr(strrchr($filelink,"/"),1);
  241. $fname=str_replace(".html","",$fname);
  242. $t=explode("/",$filelink);
  243. $id= $t[3];
  244. $post= "op=download1&usr_login=&id=".$id."&fname=".$fname."&referer=&method_free=Continue+to+Video";
  245. $ch = curl_init();
  246. curl_setopt($ch, CURLOPT_URL, $filelink);
  247. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
  248. curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt');
  249. curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
  250. curl_setopt ($ch, CURLOPT_REFERER, $filelink);
  251. curl_setopt ($ch, CURLOPT_POST, 1);
  252. curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
  253. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  254. curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
  255. $h = curl_exec($ch);
  256. curl_close($ch);
  257. if (strpos($h,"DivXBrowserPlugin") === false) {
  258. $link=get_unpack(1,11,5,$h);
  259. } else {
  260. $link=vix(1,12,9,$h,$fname);
  261. }
  262. } elseif (strpos($filelink,"vidbux") !==false) {
  263. if (strpos($filelink,"embed") === false) {
  264. $t=explode("/",$filelink);
  265. $id= $t[3];
  266. $filelink=$t[0]."/".$t[1]."/".$t[2]."/"."embed-".$id."-width-653-height-362.html";
  267. }
  268. $h = file_get_contents($filelink);
  269. $link=get_unpack(1,8,4,$h);
  270. } elseif (strpos($filelink,'movreel') !==false) {
  271. preg_match('/movreel\.com\/(embed\/)?+([\w\-]+)/', $filelink, $m);
  272. $id=$m[2];
  273. $filelink = "http://movreel.com/embed/".$id;
  274. $h = file_get_contents($filelink);
  275. $link=str_between($h,'<param name="src" value="','"');
  276. } elseif (strpos($filelink,'videoweed') !==false) {
  277. if (strpos($filelink,"embed") !== false) {
  278. preg_match('/(v=)([A-Za-z0-9_]+)/', $filelink, $m);
  279. $id=$m[2];
  280. $s=explode("/",$filelink);
  281. $filelink="http://".$s[2]."/embed.php?v=".$id."&amp;width=900&amp;height=600";
  282. }
  283. $h = file_get_contents($filelink);
  284. $link = str_between($h,'file="','"');
  285. } elseif (strpos($filelink,'novamov') !==false) {
  286. if (strpos($filelink,"embed") !== false) {
  287. preg_match('/(v=)([A-Za-z0-9_]+)/', $filelink, $m);
  288. $id=$m[2];
  289. $s=explode("/",$filelink);
  290. $filelink="http://".$s[2]."/embed.php?v=".$id."&amp;width=600&amp;height=480";
  291. }
  292. $h=file_get_contents($filelink);
  293. $file=str_between($h,'flashvars.file="','"');
  294. $filekey=str_between($h,'flashvars.filekey="','"');
  295. $l="http://www.novamov.com/api/player.api.php?user=undefined&file=".$file."&pass=undefined&key=".urlencode($filekey);
  296. $h=file_get_contents($l);
  297. $link=str_between($h,"url=","&");
  298. } elseif (strpos($filelink, 'videobb.com') !== false) {
  299. $id=substr(strrchr($filelink,"/"),1);
  300. $l="http://www.sheepser.com/vb23.php?s1=".$id;
  301. $h=file_get_contents($l);
  302. $t1=explode('url="',$h);
  303. $t2=explode('"',$t1[1]);
  304. $link=$t2[0];
  305. if (strpos($link,"videobb") === false) {
  306. $filelink="http://www.videobb.com/player_control/settings.php?v=".$id;
  307. $link=videobb($filelink);
  308. }
  309. } elseif (strpos($filelink, 'videozer.com') !== false) {
  310. $id=substr(strrchr($filelink,"/"),1);
  311. $l="http://www.sheepser.com/vz23.php?s1=".$id;
  312. $h=file_get_contents($l);
  313. $t1=explode('url="',$h);
  314. $t2=explode('"',$t1[1]);
  315. $link=$t2[0];
  316. if (strpos($link,"videozer") === false) {
  317. $filelink="http://www.videozer.com/player_control/settings.php?v=".$id;
  318. $link=videobb($filelink);
  319. }
  320. } elseif ((strpos($filelink, 'vk.com') !== false) || (strpos($filelink, 'vkontakte.ru') !== false)) {
  321. $link=vk($filelink);
  322. } elseif (strpos($filelink, 'movshare') !== false){
  323. preg_match('/(v=)([A-Za-z0-9_]+)/', $filelink, $m);
  324. $id=$m[2];
  325. if ($id == "") {
  326. $a=explode("?",$filelink);
  327. $rest = substr($a[0], 0, -1);
  328. $id= substr(strrchr($rest,"/"),1);
  329. }
  330. $filelink = "http://embed.movshare.net/embed.php?v=".$id;
  331. $baza = file_get_contents($filelink);
  332. $link = str_between($baza,'file="','"');
  333. if ($link == "") {
  334. $link=str_between($baza,'name="src" value="','"');
  335. }
  336. } elseif (strpos($filelink, 'youtube') !== false){
  337. $link=youtube($filelink);
  338. } elseif (strpos($filelink, 'flvz.com') !== false){
  339. $link=flvz($filelink);
  340. } elseif (strpos($filelink, 'rapidmov.net') !== false){
  341. $link=rapidmov($filelink);
  342. } elseif (strpos($filelink, 'putlocker.com') !== false){
  343. $link=putlocker($filelink);
  344. } elseif (strpos($filelink, 'sockshare.com') !== false){
  345. $link=putlocker($filelink);
  346. } elseif (strpos($filelink,'vimeo.com') !==false){
  347. //http://player.vimeo.com/video/16275866
  348. if (strpos($filelink,"player.vimeo.com") !==false) {
  349. $id=substr(strrchr($filelink,"/"),1);
  350. $link="http://127.0.0.1/cgi-bin/translate?stream,,http://vimeo.com/".$id;
  351. } else {
  352. $link="http://127.0.0.1/cgi-bin/translate?stream,,".$filelink;
  353. }
  354. } elseif (strpos($filelink, 'megavideo.com') !== false) {
  355. $f="/usr/local/etc//usr/local/etc/dvdplayer/megavideo.dat";
  356. if (file_exists($f)) {
  357. $h=file_get_contents($f);
  358. $MEGA_COOKIE=trim($h);
  359. } else {
  360. $MEGA_COOKIE="";
  361. }
  362. $id=megavideo($filelink);
  363. if ($MEGA_COOKIE <> "") {
  364. $link=megavideo_premium($id);
  365. } else {
  366. $link="http://127.0.0.1/cgi-bin/scripts/php1/mv.cgi?v=".$id;
  367. }
  368. }
  369. print $link;
  370. ?>