爱奇艺解析源码

作者 : King 本文共14个字,预计阅读时间需要1分钟 发布时间: 2024-10-4 共23人阅读

爱奇艺解析源码

爱奇艺解析源码

  1. echo Iqiyi::parse($url);  
  2.   
  3. class Iqiyi  
  4. {  
  5.     /** 
  6.      * [parse 解析网页获取视频ID] 
  7.      * @param  [type] $url  [description] 
  8.      * @return [type]       [description] 
  9.      */  
  10.     public static function parse($url)  
  11.     {  
  12.         $html = self::curl($url);  
  13.   
  14.         if($html){  
  15.             preg_match('#vid“:”(.*)“,#iU’,$html,$vids); 
  16.             preg_match('#tvId”:(.*),“#iU’,$html,$tvids); 
  17.             preg_match('#param\[\’isMember\’\]\s*=\s*”(.*)“;#’,$html,$bool); 
  18.             preg_match('#tvName:”(.*)“#iU’,$html,$tvName); 
  19.             preg_match('#property=”og:image“\s*content=”(.*)“#’,$html,$images); 
  20.             if (!$vids[1]) { 
  21.                 preg_match('#data-player-videoid=”(.*)“#iU’,$html,$vids); 
  22.             } 
  23.             if (!$tvids[1]) { 
  24.                 preg_match('#data-player-tvid=”(.*)“#iU’,$html,$tvids); 
  25.             } 
  26.             if (!$tvName[1]) { 
  27.                 preg_match('#name=”irTitle“\s*content=”(.*)“#’,$html,$tvName); 
  28.             } 
  29.             $ids['uid’] = empty($_uid[1])?”“:$_uid[1];                          //用户需从cookie里P00010获取,请自行修改 
  30.             $ids['qyid’] = empty($_qyid[1])? “d56mj2ujli317a4mvdxq5i73“:$_qyid[1];//用户需从cookie里QC006获取,请自行修改 
  31.             $ids['agenttype’] = 13; 
  32.             $ids['type’] = 'mp4’; 
  33.             $time = number_format(microtime(true),3,”,”); 
  34.             $ids['sgti’] = “{$ids['agenttype’]}_{$ids['qyid’]}_{$time}“; 
  35.  
  36.             $ids['title’] = $tvName[1]; 
  37.             $ids['member’] = $bool[1];//是否为付费视频 
  38.             $ids['vid’] = $vids[1]; 
  39.             $ids['tvid’] = $tvids[1]; 
  40.             $ids['image’] = isset($images[1]) ? $images[1] : “; 
  41.             $ids['src’] = '02020031010000000000’; 
  42.             $ids['url’] = $url; 
  43.             $ids['ref’] = $url; 
  44.  
  45.             $api = 'https://mixer.video.iqiyi.com/jp/mixin/videos/’.$ids['tvid’]; 
  46.             $html = self::curl($api,$ids); 
  47.             $html = str_replace('var tvInfoJs=’,”,$html); 
  48.             $json = json_decode($html,true); 
  49.  
  50.             $ids['title’] = isset($json['name’]) ? $json['name’] : $ids['title’]; 
  51.             $ids['des’] = isset($json['des’]) ? $json['des’] : $ids['des’]; 
  52.             $ids['poster’] = isset($json['imageUrl’]) ? str_replace(“.jpg“, “_480_270.jpg“,$json['imageUrl’]) : str_replace(“.jpg“, “_480_270.jpg“,$ids['image’]) ;  
  53.  
  54.             //print_r($ids);exit; 
  55.  
  56.             // 
  57.             // 
  58.             // 
  59.             $videoinfo = self::get_video($ids); 
  60.             return json_encode($videoinfo); 
  61.         } 
  62.  
  63.     } 
  64.     /** 
  65.      * [get_tmts_video 解析视频地址] 
  66.      * @param  [type] $tvid [description] 
  67.      * @param  [type] $vid  [description] 
  68.      * @return [type]       [description] 
  69.      */ 
  70.     public static function get_video($ids) 
  71.     { 
  72.         if($ids['member’]===’true’){//付费视频 
  73.             $url = './yun/?url=’.$ids['url’]; 
  74.             $videoinfo['code’] = 200; 
  75.             $videoinfo['play’] = 'iframe’; 
  76.             //$videoinfo['msg’] = $ids['title’] . '为爱奇异VIP资源!VIP资源全网搜索中….’; 
  77.             $videoinfo['data’]['url’] = $url;  
  78.             return $videoinfo;exit; 
  79.         }else{ 
  80.             $api = self::get_tmts_data($ids); 
  81.             $ids['cookie’] = 'P00001=’; 
  82.             $content = self::curl($api,$ids); 
  83.         } 
  84.  
  85.         $body = preg_replace(“#var tvInfoJs=#“,”“,$content); 
  86.  
  87.         $json = json_decode($body,true); 
  88.         //print_r($json);exit; 
  89.  
  90.         if ($json['code’]==’A00000′ && isset($json['data’])){ 
  91.             $data = $json['data’]; 
  92.             $vidl = $data['vidl’];              //视频地址列表 
  93.                 $datainfo['code’] = 200; 
  94.                 $datainfo['play’] = 'ajax’; 
  95.                 $datainfo['type’] = 'iqiyi’; 
  96.                 $datainfo['msg’] = “; 
  97.                 $datainfo['data’][“vid“] = $ids['vid’]; 
  98.                 $datainfo['data’][“tvid“] = $ids['tvid’]; 
  99.                 $datainfo['data’][“uid“] = $ids['uid’]; 
  100.                 $datainfo['data’][“qyid“] = $ids['qyid’]; 
  101.                 $datainfo['data’][“type“] = $ids['type’]; 
  102.                 $datainfo['data’][“src“] = $ids['src’]; 
  103.                 $datainfo['data’][“agenttype“] = $ids['agenttype’]; 
  104.                 $datainfo['data’][“jsdir“] = GlobalBase::https_url().’/static’; 
  105.                 $datainfo['data’][“poster“] = $ids['poster’]; 
  106.  
  107.         } 
  108.         return $datainfo; 
  109.     } 
  110.     public static function get_tmts_url($ids) {//付费视频提交cookie 
  111.         preg_match('#P00010=(\d+);#iU’,COOKIE_IQIYI,$_uid); 
  112.         preg_match('#QC006=(.*);#iU’,COOKIE_IQIYI,$_qyid); 
  113.         $domain = “http://cache.m.iqiyi.com”;  
  114.         $uid = emptyempty($_uid[1])?”“:$_uid[1];                         //用户需从cookie里P00010获取,请自行修改 
  115.         $qyid = empty($_qyid[1])? “d56mj2ujli317a4mvdxq5i73“:$_qyid[1];//用户需从cookie里QC006获取,请自行修改 
  116.         $agenttype = 13; 
  117.         $time = number_format(microtime(true),3,”,”); 
  118.         $type = $_REQUEST['isphone’] == 0 ? 'm3u8′:’mp4’; 
  119.         $tm = mb_substr($time,0,11); 
  120.         $sgti = “{$agenttype}_{$qyid}_{$time}“; 
  121.         $src = '1702633101b340d8917a69cf8a4b8c7c’ ; // “02020031010000000000“; 
  122.         $tmtsreq = “/jp/tmts/“.$ids['tvid’].”/“.$ids['vid’].”/?uid={$uid}&cupid=qc_100001_100186&platForm=h5&qyid={$qyid}&agenttype={$agenttype}&type={$type}&rate=2&sgti={$sgti}&qdv=1&qdx=n&qdy=x&qds=0&tm={$tm}&src={$src}“;//platForm=PHONE 
  123.         $vf= md5($tmtsreq.”t6hrq6k0n6n6k6qdh6tje6wpb62v7654“); //参数校验码 
  124.         $url = $domain.$tmtsreq.”&vf={$vf}“; 
  125.  
  126.         //echo $url;eixt; 
  127.  
  128.         return $url; 
  129.     } 
  130.  
  131.     public static function get_mp4_data($ids) {//付费视频提交cookie 
  132.         preg_match('#P00010=(\d+);#iU’,COOKIE_IQIYI,$_uid); 
  133.         preg_match('#QC006=(.*);#iU’,COOKIE_IQIYI,$_qyid); 
  134.         $domain = “http://cache.m.iqiyi.com”;  
  135.         $uid = emptyempty($_uid[1])?”“:$_uid[1];                         //用户需从cookie里P00010获取,请自行修改 
  136.         $qyid = empty($_qyid[1])? “d56mj2ujli317a4mvdxq5i73“:$_qyid[1];//用户需从cookie里QC006获取,请自行修改 
  137.         $agenttype = 13; 
  138.         $time = number_format(microtime(true),3,”,”); 
  139.         $type = $_REQUEST['isphone’] == 0 ? 'm3u8′:’mp4’; 
  140.         $tm = mb_substr($time,0,11); 
  141.         $sgti = “{$agenttype}_{$qyid}_{$time}“; 
  142.         $src=’02020031010010000000′; 
  143.         $a=’/tmts/’.$ids['tvid’].’/’.$ids['vid’].’/?uid=&platForm=h5&agenttype=13&type=mp4&k_ft1=8&rate=2&p=&codeflag=1&qdv=1&qdx=n&qdy=x&qds=0&t=’.$tm.’&src=’.$src; 
  144.         $vf=md5($a.’3sj8xof48xof4tk9f4tk9ypgk9ypg5ul’); 
  145.         $api=’http://cache.m.iqiyi.com’.$a.’&vf=’.$vf; 
  146.         return $api; 
  147.     } 
  148.  
  149.     public static function get_tmts1_url($ids) { 
  150.         preg_match('#P00010=(\d+);#iU’,COOKIE_IQIYI,$_uid); 
  151.         preg_match('#QC006=(.*);#iU’,COOKIE_IQIYI,$_qyid); 
  152.         $domain = “https://cache.m.iqiyi.com”;  
  153.         $uid = emptyempty($_uid[1])?”“:$_uid[1];                         //用户需从cookie里P00010获取,请自行修改 
  154.         $qyid = empty($_qyid[1])? “d56mj2ujli317a4mvdxq5i73“:$_qyid[1];//用户需从cookie里QC006获取,请自行修改 
  155.         $agenttype = 13; 
  156.         $time = number_format(microtime(true),3,”,”); 
  157.  
  158.         $type = $_REQUEST['isphone’] == 0 ? 'm3u8′:’mp4’; 
  159.         $tm = mb_substr($time,0,11); 
  160.         $sgti = “{$agenttype}_{$qyid}_{$time}“; 
  161.         $src = “02020031010000000000“; 
  162.         $authkey = md5(“.$time.$tvid); 
  163.         $tmtsreq = “/jp/tmts/“.$ids['tvid’].”/“.$ids['vid’].”/?uid=&cupid=qc_100001_100186&platForm=h5&qyid=“.$qyid.”&agenttype=13&type=mp4&nolimit=&k_ft1=8&rate=2&sgti=“.$sgti.”&codeflag=1&preIdAll=&qd_v=1&qdy=a&qds=0&tm=“.$tm.”&src=02020031010000000000“;//platForm=PHONE 
  164.  
  165.         $vf= md5($tmtsreq.”u6fnp3eok0dpftcq9qbr4n9svk8tqh7u“); //参数校验码 
  166.         $url = $domain.$tmtsreq.”&vf={$vf}“; 
  167.  
  168.         return $url; 
  169.     } 
  170.     public static function get_tmts2_url($ids) {//付费视频提交cookie 
  171.         preg_match('#P00010=(\d+);#iU’,COOKIE_IQIYI,$_uid); 
  172.         preg_match('#QC006=(.*);#iU’,COOKIE_IQIYI,$_qyid); 
  173.         $domain = “http://cache.m.iqiyi.com”;  
  174.         $uid = emptyempty($_uid[1])?”“:$_uid[1];                         //用户需从cookie里P00010获取,请自行修改 
  175.         $qyid = empty($_qyid[1])? “d56mj2ujli317a4mvdxq5i73“:$_qyid[1];//用户需从cookie里QC006获取,请自行修改 
  176.         $agenttype = 12; 
  177.         $time = number_format(microtime(true),3,”,”); 
  178.         $type = $_REQUEST['isphone’] == 0 ? 'm3u8′:’mp4’; 
  179.         $tm = mb_substr($time,0,11); 
  180.         $sgti = “{$agenttype}_{$qyid}_{$time}“; 
  181.         //$src = “02020031010000000000“; 
  182.         //$tmtsreq = “/jp/tmts/{$tvid}/{$vid}/?uid={$uid}&cupid=qc_100001_100186&platForm=h5&qyid={$qyid}&agenttype={$agenttype}&type={$type}&rate=2&sgti={$sgti}&qdv=1&qdx=n&qdy=x&qds=0&tm={$tm}&src={$src}“;//platForm=PHONE 
  183.         //$vf= md5($tmtsreq.”3sj8xof48xof4tk9f4tk9ypgk9ypg5ul“); //参数校验码 
  184.  
  185.         $t = time(); 
  186.         $k = “d5fb4bd9d50c4be6948c97edd7254b0e“; 
  187.         $src = “76f90cbd92f94a2e925d83e8ccd22cb7“; 
  188.         $sc=md5($t.$k.$vid); 
  189.         $url=’http://cache.m.iqiyi.com/jp/tmts/’.$ids['tvid’].’/’.$ids['vid’].’/?t=’.$t.’&sc=’.$sc.’&src=’.$src; 
  190.         return $url; 
  191.     } 
  192.     public static function get_app_data($ids) {  //app端的vf算法 
  193.         preg_match('#P00010=(\d+);#iU’,COOKIE_IQIYI,$_uid); 
  194.         preg_match('#QC006=(.*);#iU’,COOKIE_IQIYI,$_qyid); 
  195.  
  196.         $uid = empty($_uid[1])?”“:$_uid[1];      
  197.  
  198.         $platForm = “h5“; 
  199.  
  200.         $agenttype = “13“; 
  201.  
  202.         $type = “m3u8“; 
  203.  
  204.         $nolimit = 0; 
  205.  
  206.         $k_ft1 = 8; 
  207.  
  208.         $rate = 4; 
  209.  
  210.         $p = ““; 
  211.  
  212.         $codeflag = “1“; 
  213.  
  214.         $qdv = “1“; 
  215.  
  216.         $qdx = “n“; 
  217.  
  218.         $qdy = “x“; 
  219.  
  220.         $qds = 0; 
  221.  
  222.         $__jsT = “sgve“; 
  223.  
  224.         $qyid = empty($_qyid[1])? “d56mj2ujli317a4mvdxq5i73“:$_qyid[1];//用户需从cookie里QC006获取,请自行修改 
  225.  
  226.         $time = number_format(microtime(true),3,”,”); 
  227.  
  228.         $tm = mb_substr($time,0,11); 
  229.  
  230.         $sgti = “{$agenttype}_{$qyid}_{$time}“; 
  231.  
  232.         $src = “02028001010000000000“; 
  233.  
  234.         $tmtsreq = “/tmts/“.$ids['tvid’].”/“.$ids['vid’].”/?uid={$uid}&platForm={$platForm}&agenttype={$agenttype}&qyid={$qyid}&platForm=IPHONE&type={$type}&nolimit={$nolimit}&k_ft1={$k_ft1}&rate={$rate}&p={$p}&codeflag={$codeflag}&qdv={$qdv}&qdx={$qdx}&qdy={$qdy}&qds={$qds}&__jsT={$__jsT}&t={$tm}&src={$src}“; 
  235.  
  236.         $vf= md5($tmtsreq.”3sj8xof48xof4tk9f4tk9ypgk9ypg5ul“); //参数校验码 
  237.         $url = 'https://cache.m.iqiyi.com’.$tmtsreq.”&vf={$vf}“; 
  238.         //echo $url;exit; 
  239.  
  240.         return $url; 
  241.     } 
  242.  
  243.     public static function get_vps_data($ids){ //pc 端接口 
  244.         preg_match('#P00010=(\d+);#iU’,COOKIE_IQIYI,$_uid); 
  245.         preg_match('#QC006=(.*);#iU’,COOKIE_IQIYI,$_qyid); 
  246.  
  247.         $host = 'http://cache.video.qiyi.com’; 
  248.  
  249.         $src = '/vps?tvid=’.$ids['tvid’].’&vid=’.$ids['vid’].’&v=0&qypid=’.$ids['tvid’].’_12&src=1702633101b340d8917a69cf8a4b8c7c&platforms=PC_APP&t=’.GlobalBase::getMillisecond().’&k_tag=1&type=mp4&k_uid=’.self::get_macid().’&rs=1′; 
  250.  
  251.         //$vf = self::get_vf($src); 
  252.         $vf= md5($src.”u6fnp3eok0dpftcq9qbr4n9svk8tqh7u“); 
  253.  
  254.         $api = $host . $src . '&vf=’ . $vf; 
  255.  
  256.         if($ids['member’]===’true’){//付费视频 
  257.             $ids['cookie’] = COOKIE_IQIYI; 
  258.             $data = self::curl($api,$ids); 
  259.         }else{ 
  260.             $data = self::curl($api,$ids); 
  261.         } 
  262.  
  263.         //print_r($data);exit; 
  264.  
  265.         $data = json_decode($data,true); 
  266.  
  267.         if ($data['code’] == 'A00000’) { 
  268.             $list = $data['data’]['vp’]['tkl’][0]['vs’]; 
  269.             $dom = $data['data’]['vp’]['du’]; 
  270.             foreach ($list as $key => $value) { 
  271.                 switch ($value['bid’]) { 
  272.                     case 1: 
  273.                         $def = '普清’; 
  274.                         break; 
  275.                     case 2: 
  276.                         $def = '高清’; 
  277.                         break; 
  278.                     case 4: 
  279.                         $def = '超清’; 
  280.                         break; 
  281.                     case 96: 
  282.                         $def = '流畅’; 
  283.                         break; 
  284.                 } 
  285.  
  286.                 foreach ($value['fs’] as $k => $v) { 
  287.                     $a[$k]['file’] = self::get_pc_url_data($dom.$v['l’],$ids); 
  288.                     $a[$k]['duration’] = $v['d’]/1000; 
  289.                     $a[$k]['bytesTotal’] = $v['b’]; 
  290.                 } 
  291.                 if ($value['bid’] == 4) { 
  292.                     $_loc[0]['video’] = $a; 
  293.                     $_loc[0]['type’] = 'mp4’; 
  294.                     $_loc[0]['weight’] = 10; 
  295.                     $_loc[0]['definition’] = $def; 
  296.                 } 
  297.                 if ($value['bid’] == 2) { 
  298.                     $_loc[1]['video’] = $a; 
  299.                     $_loc[1]['type’] = 'mp4’; 
  300.                     $_loc[1]['weight’] = 10; 
  301.                     $_loc[1]['definition’] = $def; 
  302.                 } 
  303.                 if ($value['bid’] == 1) { 
  304.                     $_loc[2]['video’] = $a; 
  305.                     $_loc[2]['type’] = 'mp4’; 
  306.                     $_loc[2]['weight’] = 10; 
  307.                     $_loc[2]['definition’] = $def; 
  308.                 } 
  309.  
  310.             } 
  311.             for ($i=0; $i <= 2 ; $i++) { 
  312.                 if ($_loc[$i] == “) { 
  313.                 continue; 
  314.             } 
  315.             $key_arrays[]=$_loc[$i]; 
  316.         } 
  317.         } 
  318.         $videoinfo['code’] = 200; 
  319.         $videoinfo['data’]['poster’] = $ids['poster’]; 
  320.         $videoinfo['play’] = 'mp4_list’; 
  321.         $videoinfo['data’]['video’][0] = $key_arrays[0]; 
  322.  
  323.         print_r(json_encode($videoinfo));exit; 
  324.     } 
  325.  
  326.     public static function get_tmts_data($ids){  
  327.         $t = time()*1000; 
  328.         $src = “76f90cbd92f94a2e925d83e8ccd22cb7“; 
  329.         $key = “d5fb4bd9d50c4be6948c97edd7254b0e“; 
  330.         $vid = $ids['vid’]; 
  331.         $tvid = $ids['tvid’]; 
  332.         $sc = md5($t.$key.$vid); 
  333.         $url = “http://cache.m.iqiyi.com/jp/tmts/$tvid/$vid/?t=$t&sc=$sc&src=$src”;  
  334.         return $url;  
  335.     }  
  336.   
  337.     public static function get_pc_url_data($url,$ids){  
  338.         $data = file_get_contents($url);  
  339.   
  340.         $data = json_decode($data,true);  
  341.   
  342.         $u = $data['l’];  
  343.         return $u;  
  344.     }  
  345.   
  346.     public static function get_macid(){  
  347.         //”’获取macid,此值是通过mac地址经过算法变换而来,对同一设备不变”’  
  348.         $macid=;  
  349.         $chars = 'abcdefghijklnmopqrstuvwxyz0123456789’;  
  350.         $size = strlen($chars);  
  351.         for ($i=0; $i < 32 ; $i++) {   
  352.             $a = mt_rand(0,($size-1));  
  353.             $macid .= $chars[$a];  
  354.         }  
  355.         return $macid;  
  356.     }  
  357.     public static function get_vf($url_params){  
  358.         $sufix=;  
  359.         for ($i=0; $i <8 ; $i++) {   
  360.             for ($j=0; $j <4 ; $j++) {   
  361.                 $v4 = 13 * (66 * $j + 27 * $i) % 35;  
  362.   
  363.                 if ($v4 >= 10) {  
  364.                     $v8 = $v4 + 88;  
  365.                 } else {  
  366.                     $v8 = $v4 + 49;  
  367.                 }  
  368.   
  369.                 $sufix .= chr($v8);  
  370.   
  371.             }  
  372.             $url_params .= $sufix;  
  373.         }  
  374.         //echo $url_params;exit;  
  375.         $vf = md5($url_params);  
  376.         return $vf;  
  377.     }  
  378.     public static function iqiyi_curl($url$params = array()) {  
  379.         $ip = emptyempty($params[“ip“]) ? GlobalBase::rand_ip() : $params[“ip“];  
  380.         $header = array('X-FORWARDED-FOR:’.$ip,’CLIENT-IP:’.$ip); 
  381.         if(isset($params[“httpheader“])){ 
  382.             $header = array_merge($header,$params[“httpheader“]); 
  383.         } 
  384.         $referer = empty($params[“ref“]) ? $url : $params[“ref“]; 
  385.         $user_agent = empty($params[“ua“]) ? $_SERVER['HTTP_USER_AGENT’] : $params[“ua“] ; 
  386.  
  387.         $ch = curl_init();                                                      //初始化 curl 
  388.         curl_setopt($ch, CURLOPT_URL, $url);                                    //要访问网页 URL 地址 
  389.         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);                          //伪装来源 IP 地址 
  390.         curl_setopt($ch, CURLOPT_REFERER, $referer);                            //伪装网页来源 URL 
  391.         curl_setopt($ch, CURLOPT_USERAGENT,$user_agent);                        //模拟用户浏览器信息 
  392.         curl_setopt($ch, CURLOPT_NOBODY, false);                                //设定是否输出页面内容 
  393.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                         //返回字符串,而非直接输出到屏幕上 
  394.         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, false);                        //连接超时时间,设置为 0,则无限等待 
  395.         curl_setopt($ch, CURLOPT_TIMEOUT, 3600);                                //数据传输的最大允许时间超时,设为一小时 
  396.         curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);                       //HTTP验证方法 
  397.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);                        //不检查 SSL 证书来源 
  398.         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);                        //不检查 证书中 SSL 加密算法是否存在 
  399.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);                         //跟踪爬取重定向页面 
  400.         curl_setopt($ch, CURLOPT_AUTOREFERER, true);                            //当Location:重定向时,自动设置header中的Referer:信息 
  401.         curl_setopt($ch, CURLOPT_ENCODING, “);                                 //解决网页乱码问题 
  402.         curl_setopt($ch, CURLOPT_HEADER, empty($params[“header“])?false:true);  //不返回 header 部分 
  403.         if(!empty($params[“fields“])){ 
  404.             curl_setopt($ch, CURLOPT_POST, true);                                  //设置为 POST  
  405.             curl_setopt($ch, CURLOPT_POSTFIELDS,$params[“fields“]);                //提交数据 
  406.         } 
  407.         if(!empty($params[“cookie“])){ 
  408.             curl_setopt($ch, CURLOPT_COOKIE, $params[“cookie“]);                  //从字符串传参来提交cookies 
  409.         } 
  410.         if(!empty($params[“proxy“])){ 
  411.             curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);                  //代理认证模式 
  412.             curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);                  //使用http代理模式 
  413.             curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);  
  414.             curl_setopt($ch, CURLOPT_PROXY, “58.251.230.220:9797“);   //代理服务器地址 host:post的格式 
  415.             if(!empty($params[“proxy_userpwd“])){ 
  416.                 curl_setopt($ch, CURLOPT_PROXYUSERPWD, $params[“proxy_userpwd“]); //http代理认证帐号,username:password的格式 
  417.             } 
  418.         } 
  419.         $data = curl_exec($ch);                                                 //运行 curl,请求网页并返回结果 
  420.         curl_close($ch);                                                        //关闭 curl 
  421.         return $data; 
  422.     } 
  423.     public static function curl($url,$ids) 
  424.     { 
  425.         $params[“ua“] = !empty($ids['ua’]) ? $ids['ua’] : “Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36“; 
  426.         $params[“ip“] = “14.21.98.117“;//伪装为固定IP,否则会报异地登录,会封号,不要更改 
  427.         if (isset($ids['cookie’])) { 
  428.             $params[“cookie“] = $ids['cookie’]; 
  429.         } 
  430.         $params[“ref“] = “https://www.iqiyi.com”;  
  431.   
  432.         //$params[“proxy”] = PROXY;  
  433.         //return GlobalBase::iqiyi_curl($url,$params);  
  434.         return self::iqiyi_curl($url,$params);  
  435.     }  
  436. }  

下载仅供下载体验和测试学习,不得商用和正当使用。

[ppwp passwords=”zhishitu.cn”]

下载体验

应版权要求,禁止分享,敬请谅解,有问题务必找客服哈。

如何获取解压密码

有问题找客服哈,并领取学习福利!

[/ppwp]

点击下载

小鱼网是一个美好的开源学习社区,学习编程,学习WordPress,下载WordPress插件主题,
小鱼网 » 爱奇艺解析源码

常见问题FAQ

发表回复

分享最优质的学习资料

立即查看 了解详情