20,359
社区成员
发帖
与我相关
我的任务
分享
<?php
error_reporting(0);
$beginUrl='';
if($_POST['url']){
$url=$_POST['url'];
$beginUrl=$url;
$ip=rand(10,200).'.'.rand(10,200).'.'.rand(10,200).'.'.rand(10,200);
$headers=array(
'CLIENT-IP:'.$ip,
'X-FORWARDED-FOR:'.$ip,
);
$urlRes=curl_get($url,$headers);
$urlRule="/(?<=\<source\ssrc\=\").*(?=\"\stype\=\'video)/";
preg_match($urlRule,$urlRes,$url);
$url=$url['0'];
}
function curl_get($url,$headers){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
if($headers){
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
}
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta charset="utf-8" />
<title>视频解析</title>
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" id="viewport" name="viewport" />
<style>
.clear{clear:both;}
form{width:90%;margin:120px auto;}
.down{width:90%;margin:20px auto;}
.key{width:80%;height:40px;outline: none;font-size:20px;text-indent:10px;float:left;}
.submit{height:44px;line-height:44px;padding-left:20px;padding-right:20px;background:#ff9735;border:none;color:#fff;float:left;margin-left:15px;font-size:20px;cursor:pointer;text-decoration:none;}
.down textarea{width:85%;height:40px;}
.foot{width:100%;position: fixed;bottom: 0;text-align:center;border-top:1px solid #e7e7e7;color:#999;font-size:14px;}
.foot .container{margin:0 auto;}
.foot .container a{color:#337ab7;text-decoration:none;}
</style>
</head>
<body>
<form action="../api/index.php" method="post">
<input class="key" placeholder="输入视频链接" name="url" type="text" value="<?php echo $beginUrl; ?>">
<button type="submit" class="submit">采集</button>
</form>
<div class="clear"></div>
<div class="down">
<input class="key" placeholder="下载地址" type="text" value="<?php echo $url; ?>">
<a target= _blank class="submit" href="<?php echo $url; ?>" download="a">立即下载</a>
</div>
</body>
</html>