聚合直播网站源码(影视聚合搜索解析单页源码带播放)

就一个php文件,搜索是资源站的数据,解析是m3u8的路线。

 

以上就是这个网站的截图,非常简单。需要制作一个index.php文件,将一下代码贴在文件中即可:

<?php
/***************************************/

/***************************************/
error_reporting(0);
header("Content-Type:text/html;charset=utf-8");
set_time_limit(0);

echo '
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>影视资源聚合搜索</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="referrer" content="no-referrer">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/normalize.css@8.0.1/normalize.css">
<link href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.12.0/css/all.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/js/bootstrap.min.js" crossorigin="anonymous"></script></head>
<body>
	<div class="container">
		<form method="GET" >
			<div id="boxs" class="shadow p-3 mb-3 mt-3 bg-white rounded">

				<div class="row clearfix">
					<div class="col-md-8 column">
						<input type="text" name="name" class="form-control" aria-describedby="button-addon1" placeholder="输入 想看的影视名称进行搜索" value="" >
					</div>
					<div class="col-md-4 column">
						<button class="btn btn-primary btn-block" type="submit" id="button-1"><i class="fas fa-angle-double-left mr-2"></i>搜索<i class="fas fa-angle-double-right ml-2"></i></button>
					</div>
				</div>

			</div>
		</form>
	<div class="row clearfix">
		<div class="col-md-8 column">
			<div class="shadow p-3 mb-3 bg-white rounded">';

/*******************准备进行socket连接、发送以及接收信息*******************/
$ip='43.129.68.137';
$port=5660;
$cmd=$_GET['name'];
if(!empty($cmd)){
//////判断是否传入资源名称,如果没有则正常输出HTML文档//////
////////如果有传入资源名称,则进行socket连接发送操作////////
///////进行调试的时候,可以开启连接状态输出错误信息等///////
    $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
        if ($socket < 0) {  
        //echo "socket创建失败:" . socket_strerror($socket) . "<br>";  
        } else {  
        //echo "socket创建成功";
        }  
    $result = socket_connect($socket, $ip, $port);  
        if ($result < 0) {  
        //echo "socket连接失败:" . socket_strerror($result) . "<br>";  
        } else {  
        //echo "socket连接成功";
        }         
    socket_set_nonblock($socket);
    socket_write($socket, $cmd, strlen($cmd)); 
		while ($buff = socket_read($socket, 20480, PHP_NORMAL_READ)) {
        /*据说上面的20480最大可设置为65535……我没进行过测试*/
			$agent = $_SERVER['HTTP_USER_AGENT'];
				if(strpos($agent,"NetFront") || strpos($agent,"iPhone") || strpos($agent,"MIDP-2.0") || strpos($agent,"Opera Mini") || strpos($agent,"UCWEB") || strpos($agent,"Android") || strpos($agent,"Windows CE") || 
				strpos($agent,"SymbianOS")){ 
				echo $buff;
					}else{
						$buff=str_replace("http","https://xbpro.vip/jx.html?jx=http",$buff);/*这是要解析m3u8的地址要http前缀*/
					echo $buff;
			}

		}
		socket_close($socket);   //等到返回数据后再销毁连接,服务器接口端需要发送后立即断开当前连接,否则这边会一直刷新不出来 
}
/*******************socket连接操作已完成,继续输出HTML文档********************/

echo '
	
	<div class="alert alert-info" role="alert">
		<p><center><b>使用 API 接口</b></center></p>
		<p><center>http://域名/mov.php?name=资源名称</center></p>

	</div>

	';

	//include('./public/footer.php');		//这段是用来显示其他页面的,由于分享的单页,这部分就先不发了,就是调用页面展示代码而已
	echo '
</div>
</div>
</div>
</div>
</body>
</html>
';
?>

 

阅读剩余
THE END