<!DOCTYPE> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>地址解析</title> </head> <body> <?php $a = file(‘F:/91url.csv‘); foreach($a as $line => $content){ $res = explode(‘,‘,$content); echo ‘line ‘.($res[0]).‘ : ‘.iconv(‘GB2312‘,‘UTF-8‘, $res[1]).‘ ‘.$res[2].‘<br />‘; $num=$res[0]; $title=iconv(‘GB2312‘,‘UTF-8‘, $res[1]); $time=$res[2]; $longtime=$res[4]; $viewnum=$res[5]; $source=$res[6]; geturl($num,$title,$time,$longtime,$viewnum,$source); } function geturl($num,$title,$time,$longtime,$viewnum,$source){ //91porn解析,freeGet获得解析地址 $url = "http://freeget.co/video/extraction"; $post_data = "url=".$source; $post_data.="&X-CSRFToken=1467187852##479bcd4cbd4c61137a65a8a7419947fbdc32f478"; $headers = array( ‘Accept-Encoding:utf-8, deflate‘, ‘Accept-Language:zh-CN,zh;q=0.8‘, ‘Content-Length:127‘, ‘Content-Type:application/x-www-form-urlencoded; charset=UTF-8‘, ‘Cookie:incap_ses_401_649914=31EbXVOgx0r6Ql5TmqOQBdjxdFcAAAAAu7MrrqICFZvpjsIw5VriGQ==; incap_ses_434_649914=wx2HcnWH7GDQCChRweAFBt/xdFcAAAAAczn9Ohl2VBPqxEd8kRi2GA==; visid_incap_649914=2hb3ym0OQ9C7sr1krqKCQTUObVcAAAAAQUIPAAAAAADQQCM/QP5jhCXO3+mlIKmg; incap_ses_199_649914=5f1kYgea2E82s51Ks/3CAgHydFcAAAAA0t8X/XhyGO6vLAivDqiKDQ==; incap_ses_406_649914=vs5zGBHLcDl2DJYFemeiBSHydFcAAAAAdokyZQkGGNWotlqD7VNjJg==; incap_ses_407_649914=U4VYNM5iO1l1H0VP7/SlBWXydFcAAAAAifL73Yq/OnIgRqKWiWPqUg==; _ga=GA1.2.1738858661.1466764840; _gat=1; session=eyJfZnJlc2giOmZhbHNlLCJjc3JmX3Rva2VuIjp7IiBiIjoiTkdFek9HRmtNakkxTldVM05EVXpZMkZoTldKaE5tWXpOV014TlRBNU1UZ3dPVGcyTkRNMU5BPT0ifX0.ClaHmg.RREoQo7DozBdXN48AaSMjL3DkhE‘, ‘Host:freeget.co‘, ‘Origin:http://freeget.co‘, ‘Proxy-Connection:keep-alive‘, ‘Referer:http://freeget.co/‘, ‘User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36‘, ‘X-CSRFToken:1467286379##5c7b9f276ed86f80c0d9eb4ebd43ec1e1204644f‘, ‘X-Requested-With:XMLHttpRequest‘, ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); //设置URL curl_setopt($ch, CURLOPT_HEADER, true); //设置显示响应头 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);//设置参数 $content = curl_exec($ch); $headArr = explode("\r\n", $content); //解析url foreach ($headArr as $loop) { if(strpos($loop, "token") !== false){//找到token $token = trim(substr($loop, 11,36)); } if(strpos($loop, "view_key") !== false){//找到view_key $view_key = trim(substr($loop, 63,20)); } } //echo $loop."<br />"; $url001=‘http://freeget.co/video/‘.$view_key.‘/‘.$token; echo ‘视频解析地址:<a href=‘.$url001.‘ target="_blank">‘.$url001.‘</a><br />‘; //http://freeget.co/video/e2eff4de4577f02ecaff/e3a0cb68-0b61-4d10-aba0-34c1a6c00a05 curl_close($ch); $User_Agent="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0"; $cookie=‘incap_ses_401_649914=31EbXVOgx0r6Ql5TmqOQBdjxdFcAAAAAu7MrrqICFZvpjsIw5VriGQ==; incap_ses_434_649914=wx2HcnWH7GDQCChRweAFBt/xdFcAAAAAczn9Ohl2VBPqxEd8kRi2GA==; visid_incap_649914=2hb3ym0OQ9C7sr1krqKCQTUObVcAAAAAQUIPAAAAAADQQCM/QP5jhCXO3+mlIKmg; incap_ses_199_649914=5f1kYgea2E82s51Ks/3CAgHydFcAAAAA0t8X/XhyGO6vLAivDqiKDQ==; incap_ses_406_649914=vs5zGBHLcDl2DJYFemeiBSHydFcAAAAAdokyZQkGGNWotlqD7VNjJg==; incap_ses_407_649914=U4VYNM5iO1l1H0VP7/SlBWXydFcAAAAAifL73Yq/OnIgRqKWiWPqUg==; _ga=GA1.2.1738858661.1466764840; _gat=1; session=eyJfZnJlc2giOmZhbHNlLCJjc3JmX3Rva2VuIjp7IiBiIjoiTkdFek9HRmtNakkxTldVM05EVXpZMkZoTldKaE5tWXpOV014TlRBNU1UZ3dPVGcyTkRNMU5BPT0ifX0.ClaHng.htbZv-MQsVDV4hm8gTq3JuRzk84‘; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url001); //设置URL curl_setopt($ch, CURLOPT_COOKIE, $cookie); //设置cookies curl_setopt($ch,CURLOPT_USERAGENT,$User_Agent); //设置代理浏览器 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $content = curl_exec($ch); $content=strip_tags($content);//去除html标签 //echo $content; if(strpos($content, "http://91.p9p.co/ev.php") == true){//找到Location $purl = trim(substr($content, strpos($content, "http://91.p9p.co/ev.php"),98)); echo ‘在线播放地址:<a href=‘.$purl.‘ target="_blank">‘.$purl.‘</a><br />‘; writ($num,$title,$time,$longtime,$viewnum,$purl); } curl_close($ch); $vid=substr($purl,29,60); $vid="http://91.p9p.co/getfile_jw.php?VID=".$vid; //echo ‘下载地址:<a href=‘.$vid.‘ target="_blank">‘.$vid.‘</a><br /><br />‘; //http://91.p9p.co/getfile_jw.php?VID=6b66GePT6a7fbG4S9OtDVEi8UjkIordpwUYHz8IQenHTURLd }; function writ($num,$title,$time,$longtime,$viewnum,$url){ $file = "F:/data.txt"; $content = $num.‘,‘.$title.‘,‘.$time.‘,‘.$longtime.‘,‘.$viewnum.‘,‘.$url."\r\n"; //要写入的内容 if(!$fp = fopen($file,‘a+‘)) //打开文件$file时,使用追加模式,此时文件指针会在文件开始处 { echo "打开文件$file失败!"; } if(fwrite($fp,$content) === false) //将内容写入文件 { echo "写入文件失败!"; } else { echo "写入成功!<br />"; } fclose($fp); } ?> </body> </html>
时间: 2024-10-27 12:28:54