text: <?php
  /**
   * @id       y2c.php-2014-2-1
   * @desc     人人影视(yyets.com) 磁力链接输出
   * @author   Yaseng [Yaseng@UAUC.NET]
   **/
  $str=$_GET['keyword']; 
  if(!$str){
  	
  	exit();
  	
  }
  
  $lists=get("http://www.yyets.com/search/index?keyword=".urldecode($str)."&type=");
  
   
  
  if(preg_match('/<div class=\"all_search_li2\"><a href="(.*)\" target=/', $lists, $list)){
  
  	//$Magnet
  	//<li episode=(.*?)<span class="a">(.*?)</span>(.*?)电驴</a><a (.*?)</li>
  	//<li episode=(.*?)<span class="a">(.*?)</span>(.*?)urn:btih:(.*?)&
  	//<li episode=(.*?)<span class="a">(.*?)<\/span>(.*?)urn:btih:([A-Za-z\d]{32,})&/
  	$tvs=get($list[1]);
  
  
  
  	$arr_tv=array();
  	if(preg_match_all('/<li episode=(.*?)<span class="a">(.*?)<\/span>(.*?)type="magnet/', $tvs, $matches)){
  
  
      $arr_tv_name=($matches[2]);
      $arr_tv_magnet=($matches[3]);
  		$n_tv=count($arr_tv_name);
   
  
  
  		for($i=0;$i< $n_tv ; $i++){
   
  
  			if(preg_match("/urn:btih:([A-Za-z\d]{32,})/", $arr_tv_magnet[$i], $magnet)){
  
  				echo  "magnet:?xt=urn:btih:".$magnet[1]."&".$arr_tv_name[$i]."</br>";
  
  			}
  
  
  		}
  
  
  
  	}else{
  
  		exit("Nothing");
  
  
  	}
  
  
  
  
  }
  
  function  get($url){
  
  	$ip="115.239.210.27";
  	$agetnt="Baiduspider+(+http://www.baidu.com/search/spider.htm)";
  	$referer="www.baidu.com";
  	$option = array(
  	'http' => array(
  	'timeout'=>60,
  	'header'=>"refererer:{$referer}"."\r\n"."User-Agent:{$agetnt}"."\r\n"."X-FORWARDED-FOR:{$ip}"."\r\n"."CLIENT-IP:{$ip}",)
  	);
  	return file_get_contents($url, false,stream_context_create($option));
  
  
  }
  
  
  ?>
  