watch php,watch.php

require_once "lang.conf.php";

include('./lib.php');

if(!is_array($_GET)&&count($_GET)>0){

exit();

}

$videodata=get_video_info($_GET['v'],APIKEY);

$headtitle=$videodata['items']['0']['snippet']['title'].' - '.SITE_NAME;

include("./header.php");

if($videodata['pageInfo']['totalResults'] == '0' && $videodata['pageInfo']['resultsPerPage']== '0'){

header("Location: ./error.php");

exit();

}

//记录历史浏览观看记录

$tt=time()+1814400;

if(!isset($_COOKIE['history'])){

setcookie("history",$videodata['items']['0']['id'], $tt);

}else{

$history=$_COOKIE['history'];

$histmp=explode('@',$history);

//重复的浏览历史只记录最新一次

if (in_array($videodata['items']['0']['id'] ,$histmp)){

$akey=array_search($videodata['items']['0']['id'],$histmp);

unset($histmp[$akey]);

array_unshift($histmp,$videodata['items']['0']['id']);

}else{

array_unshift($histmp,$videodata['items']['0']['id']);

}

//最大观看记录条数,超出的删除

if(count($histmp)==30){

array_pop($histmp);

}

//防止cookies字节溢出

if(count($histmp)==40){

$histmp=array_slice($histmp,20);

}

$histmp1=implode('@',$histmp);

setcookie('history',$histmp1, $tt);

}

?>

<?php echo $videodata['items']['0']['snippet']['title'] ?>

if(!empty($videodata['items']['0']['snippet']['description'])){

preg_match_all('#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $videodata['items']['0']['snippet']['description'], $match);

$description=$videodata['items']['0']['snippet']['description'];

foreach ($match[0] as $v) {

$k=''. $v.'';

$description=str_replace($v,$k,$description);

}

echo $description;

} else {

echo $lang['WATCH_M1'];

};

?>

<?php echo $lang['WATCH_CAT']?><?php echo categorieslist($videodata['items']['0']['snippet']['categoryId'])?>

<?php echo $lang['WATCH_DOWN']?>

<?php echo $lang['WATCH_4KPB']?>

foreach ($videodata['items'][0]['snippet']['tags'] as $v) {

echo ''.$v.'';

}?>

$(function(){

var slideHeight = 60; // px

var defHeight = $('#des').height();

if(defHeight >= slideHeight){

$('#des').css('height' , slideHeight + 'px');

$('#read-more').append('');

$('#read-more').click(function(){

var curHeight = $('#des').height();

if(curHeight == slideHeight){

$('#des').animate({

height: defHeight

}, "normal");

$('#read-more').html('');

$('#gradient').fadeOut();

}else{

$('#des').animate({

height: slideHeight

}, "normal");

$('#read-more').html('');

$('#gradient').fadeIn();

}

return false;

});

}

});

videojs('h5player').videoJsResolutionSwitcher();

$(function () {$('[data-toggle="popover"]').popover()});

include("./footer.php");

?>

一键复制

编辑

Web IDE

原始数据

按行查看

历史

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值