代码拉取完成,页面将自动刷新
同步操作将从 缘维/you2php 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<?php
@session_start();
@ob_start();
error_reporting(0);
@header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
@header( 'Date: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
@header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
@header( 'Cache-Control: private, max-age=1' );
@header("Pragma: no-cache");
@header("Content-Disposition: filename=".$_GET["id"].".mp4");
include('./YouTubeDownloader.php');
$yt = new YouTubeDownloader();
$u="https://www.youtube.com/watch?v=".$_GET['vv'];
$links = $yt->getDownloadLinks($u);
$file_path=$links['22']['url'];
function read_body(&$ch,&$string){
global $loadedsize;
$rtn=strlen($string);
$loadedsize+=($rtn/1024);
print($string);
@ob_flush();
@flush();
if (0!=connection_status()) {
curl_close($ch);
exit();
}
@$string = NULL;
//@unset($string);
return $rtn;
}
function read_head(&$ch,&$header){
if (!strpos($header,"Cache") && !strpos($header,"ocation") )
@header(substr($header,0,strpos($header,"\r")));
return strlen($header);
}
$header1 = array('Expect: ','Accept: */*');
//$_SERVER['HTTP_RANGE'] = 'bytes=3902905-';
if (isset($_SERVER['HTTP_RANGE'])) {
$header1[] = 'Range: '.$_SERVER['HTTP_RANGE'];
$header1[] = 'Referer: '.$file_path;
}
$header1[] = 'User-Agent: '.$_SERVER['HTTP_USER_AGENT'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $file_path);
curl_setopt($ch, CURLOPT_TIMEOUT, 600);
@curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION , true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header1);
curl_setopt($ch, CURLOPT_HEADERFUNCTION, "read_head"); //
curl_setopt($ch, CURLOPT_WRITEFUNCTION, "read_body"); //
//set_error_handler("customError");
@ob_clean();
curl_exec($ch);
?>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。