抓取公众号里的视频

抓取公众号里的视频的真实链接

		$url = $spiderurl;  //https://mp.weixin.qq.com/s/C4vorgQHz79XaBwa8pJRRg
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL,$url);
		curl_setopt($ch, CURLOPT_HEADER,0);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);//禁止调用时就输出获取到的数据
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
		$result = curl_exec($ch);
		curl_close($ch);
        
		$result=preg_replace("/[\t\n\r]+/","",$result);


        //获取视频
        preg_match_all('/\/U',$result,$iframe);
        foreach ($iframe[0] as $k => $v) {
            preg_match_all('/data-src\=\"(.*)\"/U',$v,$ftml);
            //preg_match_all('/vid\=\"(.)*/U',$ftml[1][0],$vid);
            preg_match_all('/vid\=(.*)$/U',$ftml[1][0],$vid);
            if(strpos($vid[1][0],'wxv_') !== false){
                $vhtml = file_get_contents("https://mp.weixin.qq.com/mp/videoplayer?action=get_mp_video_play_url&preview=0&__biz=&mid=&idx=&vid=".$vid[1][0]."&uin=&key=&pass_ticket=&wxtoken=&appmsg_token=&x5=0&f=json");
                $vurls = json_decode($vhtml,true);
                $wxvidep = '

'; }else{ //$vhtml = file_get_contents("https://vv.video.qq.com/getinfo?otype=json&appver=3.2.19.333&platform=11&defnpayver=1&vid=".$vid[1][0]); $vhtml = file_get_contents('https://h5vv.video.qq.com/getinfo?callback=txplayerJsonpCallBack_getinfo_67771&&defaultfmt=auto&otype=json&appver=3.4.40&platform=11001&sdtfrom=v5010&defnpayver=0&appVer=3.4.40&host=v.qq.com&ehost=https%3A%2F%2Fv.qq.com%2Ftxp%2Fiframe%2Fplayer.html&refer=v.qq.com&sphttps=1&spwm=4&vid='.$vid[1][0].'&defn=auto&show1080p=false&dtype=1&clip=4&fmt=auto&defsrc=1'); preg_match('/txplayerJsonpCallBack_getinfo_67771\((.*)\)$/Uis', $vhtml, $info); $sxurl = json_decode($info[1],true); $ssurl = $sxurl['vl']['vi'][0]['ul']['ui'][0]['url'].$sxurl['vl']['vi'][0]['fn']."?vkey=".$sxurl['vl']['vi'][0]['fvkey']; //$ssurl = "https://v.qq.com/txp/iframe/player.html?origin=https%3A%2F%2Fmp.weixin.qq.com&vid=".$vid[1][0]."&autoplay=false&full=true&show1080p=false&isDebugIframe=false"; //https://apd-300d1bdf6c94058ebb1c37cfc4ab78a6.v.smtcdns.com/om.tc.qq.com/Adz2qPF4oHsF64GEsSf-3576GTGkP6ta6ecTVgaUW34k/uwMROfz2r5zEIaQXGdGnC2dfJ7xlHUZLN7WLSNBHzUj-9W46 $wxvidep = '

'; } var_dump($wxvidep); }

你可能感兴趣的:(抓取公众号里的视频)