百家号为百度旗下的自媒体平台,注册用户可以发布图文和视频,在百家号发布的视频与好看视频服务器是互通的,如果想要读取解析调用百家号视频链接php读取解析调用百家号视频链接代码与php读取解析调用百度好看
百家号为百度旗下的自媒体平台,注册用户可以发布图文和视频,在百家号发布的视频与好看视频服务器是互通的,如果想要读取解析调用百家号视频链接
php读取解析调用百家号视频链接代码与php读取解析调用百度好看视频代码不同之处在于,前者解析的视频是无水印的,而后者则有好看视频水印,百度好看视频的ID与百家号的视频ID是相同的
下面就是接口源码:
//使用方法?id=百家号或好看视频的ID <?php error_reporting(0); $domain = trim($_SERVER['SERVER_NAME']); $domainList = "127.0.0.1,localhost,www.8hi.com.cn"; $diymusic = '盗后执行的链接'; if(!preg_match('/('.$domain.')/i', $domainList)){ header('location:'.$diymusic); exit(); } $id = isset($_GET['id']) ? addslashes($_GET['id']) : '1394737638103799666'; $url = 'http://mbd.baidu.com/newspage/data/videoshare?nid=sv_'.$id; $curl = curl_init(); $header = array( 'Host: mbd.baidu.com', 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' ); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_HTTPHEADER,$header); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); $response = curl_exec($curl); curl_close($curl); preg_match('/window.jsonData.*?=.*?(.*?);<\/script>/i',$response,$matchs); $jsondat = json_decode($matchs[1],true); $videourl = str_replace('http:','https:',$jsondat['data']['videoInfo']['clarityArr'][0]['url']); header("location: $videourl"); exit();
粉丝
0
关注
0
收藏
0