Refine code

pull/39/head
david082321 2 years ago committed by GitHub
parent 22e05c2c32
commit c1bed9ed46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,7 +3,7 @@
define('SYSTEM', TRUE);
// 代码放置路径(通常不需要修改)
define('ROOT_PATH',$_SERVER['DOCUMENT_ROOT'].'/');
define('ROOT_PATH', $_SERVER['DOCUMENT_ROOT'].'/');
// 封锁
define('BLOCK_TYPE', 'blacklist'); // 封锁类型blacklist 在线黑名单, whitelist 在线白名单, local_blacklist 本地黑名单, local_whitelist 本地白名單, 不是填写前面几个就是不封锁

@ -17,7 +17,7 @@ include (ROOT_PATH."utils/process.php");
if ((CID != "" || EP_ID != "") && WEB_ON == 1) {
// Web接口
$path = "/pgc/player/web/playurl";
$host = get_host($type,$cache_type);
$host = get_host($type, $cache_type);
} else {
// 欢迎语
header('Content-Type: text/html; charset=utf-8');
@ -46,7 +46,7 @@ if (IP_RESOLVE == 1) {
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}

@ -26,7 +26,7 @@ $query = $add_query($type, $query, "");
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}

@ -26,7 +26,7 @@ $query = $add_query($type, $query, "");
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}

@ -34,7 +34,7 @@ $query = $add_query($type, $query, "");
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}

@ -35,12 +35,12 @@ $query = $add_query($type, $query, "");
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}
// 412提醒
check_412($output,$get_area);
check_412($output, $get_area);
// 替换内容
include (ROOT_PATH."utils/replace.php");
// 返回内容给用户

@ -28,7 +28,7 @@ $query = $add_query($type, $query, "");
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}

@ -34,7 +34,7 @@ $query = $add_query($type, $query, "");
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}

@ -34,7 +34,7 @@ $query = $add_query($type, $query, "");
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}

@ -32,7 +32,7 @@ if (IP_RESOLVE == 1) {
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}

@ -14,7 +14,7 @@ if (SAVE_CACHE == 1) {
// 处理用户传入参数
include (ROOT_PATH."utils/process.php");
// 设置host
$host = get_host($type,$cache_type);
$host = get_host($type, $cache_type);
// 锁区、web接口、X-From-Biliroaming
include (ROOT_PATH."utils/lock_area.php");
// 鉴权、替换access_key、获取缓存
@ -35,12 +35,12 @@ $query = $add_query($type, $query, "");
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}
// 412提醒
check_412($output,$get_area);
check_412($output, $get_area);
// 替换内容
include (ROOT_PATH."utils/replace.php");
// 返回内容给用户

@ -14,7 +14,7 @@ if (SAVE_CACHE == 1) {
// 处理用户传入参数
include (ROOT_PATH."utils/process.php");
// 设置host
$host = get_host($type,$cache_type);
$host = get_host($type, $cache_type);
// 锁区、web接口、X-From-Biliroaming
include (ROOT_PATH."utils/lock_area.php");
// 鉴权、替换access_key、获取缓存
@ -35,12 +35,12 @@ $query = $add_query($type, $query, "");
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}
// 412提醒
check_412($output,$get_area);
check_412($output, $get_area);
// 替换内容
include (ROOT_PATH."utils/replace.php");
// 返回内容给用户

@ -14,7 +14,7 @@ if (SAVE_CACHE == 1) {
// 处理用户传入参数
include (ROOT_PATH."utils/process.php");
// 设置host
$host = get_host($type,$cache_type);
$host = get_host($type, $cache_type);
// 锁区、web接口、X-From-Biliroaming
include (ROOT_PATH."utils/lock_area.php");
// 鉴权、替换access_key、获取缓存
@ -32,7 +32,7 @@ $query = $add_query($type, $query, "");
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}

@ -129,7 +129,7 @@ if (ACCESS_KEY != "") { // access_key 存在
write_log();
}
// 开始ban
$support_replace_type = array("hlw","tom","txbb","xyy","all","random"); // 允许替换的类型兼容旧版config
$support_replace_type = array("hlw", "tom", "txbb", "xyy", "all", "random"); // 允许替换的类型兼容旧版config
if ($is_baned) {
if (in_array(REPLACE_TYPE, $support_replace_type)) {
include (ROOT_PATH."utils/replace_playurl.php");

@ -34,8 +34,8 @@
@$total = $array['data']['total'];
@$pages = $array['data']['pages'];
@$items_old = $array['data']['items'];
$items_new= trim(json_encode($items_old, 320),'[]');
$items = str_replace('["追番","已追番"]','{"0":"追番","1":"已追番"}',$items_new);
$items_new= trim(json_encode($items_old, 320), '[]');
$items = str_replace('["追番","已追番"]', '{"0":"追番","1":"已追番"}', $items_new);
} else {
$trackid = "";
$exp_str = "";

@ -71,14 +71,14 @@
}
$sub_count = count($sub_arr);
$add_arr = array(
"id"=>1,
"key"=>$key,
"title"=>"[非官方]".$lang."(".SUBTITLE_TEAM_NAME.")",
"url"=>"https://".$url,
"is_machine"=>false
"id" => 1,
"key" => $key,
"title" => "[非官方]".$lang."(".SUBTITLE_TEAM_NAME.")",
"url" => "https://".$url,
"is_machine" => false
);
array_unshift($sub_arr,$add_arr); //这个会放在前面
//array_push($sub_arr,$add_arr); //这个会放在后面
array_unshift($sub_arr, $add_arr); //这个会放在前面
//array_push($sub_arr, $add_arr); //这个会放在后面
if ($ss_type == "result") {
$array['result']['modules'][0]['data']['episodes'][$ep]['subtitles'] = $sub_arr;
} else {

@ -3,7 +3,7 @@
if(!defined('SYSTEM')) {exit();}
$member_type = 0; // 判断用户状态
function get_webpage($url,$host="",$ip="") {
function get_webpage($url, $host="", $ip="") {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if (PROXY_ON == 1) { // 指定代理
@ -55,7 +55,7 @@ function get_blacklist($uid) {
return $output;
}
function get_host($type,$cache_type) {
function get_host($type, $cache_type) {
switch ($type) {
case 1: // playurl
switch (AREA) {
@ -154,7 +154,7 @@ function get_userinfo() {
}
// 412 提醒
function check_412($output,$get_area) {
function check_412($output, $get_area) {
if (TG_NOTIFY == 1) {
$status = json_decode($output, true);
$msg = "";
@ -167,12 +167,12 @@ function check_412($output,$get_area) {
if ($latest_code != $status['code']) {
if ($status['code'] == -412) {
$msg = '破服务器412啦地区:' . $get_area;
write_status($status['code'],$get_area);
write_status($status['code'], $get_area);
} else {
if ($latest_code == -412) {
$msg = '破服务器恢复啦,地区:' . $get_area;
}
write_status(0,$get_area);
write_status(0, $get_area);
}
}
}
@ -221,7 +221,7 @@ function appkey2sec($appkey) {
// mobi_app 查表
// appkey 反查
function appkey2mobi($appkey,$flip=false) {
function appkey2mobi($appkey, $flip=false) {
if ($appkey == "") {return "";}
$appkey2mobi = array("57263273bc6b67f6" => "android", // 安卓 客户端
"bca7e84c2d947ac6" => "android", // 安卓 客户端 登录专用
@ -279,7 +279,7 @@ function check_appkey($appkey="1d8b6e7d45233436") {
// 检查 mobi_app
function check_mobi_app($mobi_app="iphone") {
$appkey = appkey2mobi($mobi_app,$flip=true);
$appkey = appkey2mobi($mobi_app, $flip=true);
$appsec = appkey2sec($appkey);
if ($appkey == "" || $appsec == "") {
return array("", "", "", "");

@ -18,7 +18,7 @@ try {
if (REDIS_ON) {
include 'redis-class.php';
try {
$redisConn = new redisFunc(REDIS_HOST,REDIS_PORT,REDIS_PASS);
$redisConn = new redisFunc(REDIS_HOST, REDIS_PORT, REDIS_PASS);
} catch(Exception $e) {
echo 'redis连接失敗';
}
@ -68,7 +68,7 @@ function get_userinfo_fromsql() {
$vnum = $cres -> fetch();
if (!$vnum) {
$member_type = 0; //未登录
return ["0","0","0","0"];
return ["0", "0", "0", "0"];
}
$uid = $vnum['uid'];
$add_time = $vnum['add_time'];
@ -89,10 +89,10 @@ function get_cache() {
global $cache_type;
global $refresh_cache;
if (REDIS_ON) {
$redisConn = new redisFunc(REDIS_HOST,REDIS_PORT,REDIS_PASS);
if ($redisConn->check(AREA.'-'.$member_type.'-'.$cache_type.'-'.CID.'-'.EP_ID)) {
@$cache = $redisConn->get(AREA.'-'.$member_type.'-'.$cache_type.'-'.CID.'-'.EP_ID);
@$expired_time = $redisConn->ttl(AREA.'-'.$member_type.'-'.$cache_type.'-'.CID.'-'.EP_ID)+time();
$redisConn = new redisFunc(REDIS_HOST, REDIS_PORT, REDIS_PASS);
if ($redisConn -> check(AREA.'-'.$member_type.'-'.$cache_type.'-'.CID.'-'.EP_ID)) {
@$cache = $redisConn -> get(AREA.'-'.$member_type.'-'.$cache_type.'-'.CID.'-'.EP_ID);
@$expired_time = $redisConn -> ttl(AREA.'-'.$member_type.'-'.$cache_type.'-'.CID.'-'.EP_ID)+time();
} else {
$cache = "";
}
@ -114,8 +114,8 @@ function get_cache() {
$cache = str_replace("\r", "\\r", $cache);
$cache = str_replace("\n", "\\n", $cache);
if (QN != "" && ($cache_type == "app" || $cache_type == "appV2")) {
$cache = str_replace('"data":{"video_info":{"quality":','"data":{"video_info":{"quality":'.QN.',"quality_fuck":',$cache);
$cache = str_replace('"data":{"playurl":{"quality":','"data":{"playurl":{"quality":'.QN.',"quality_fuck":',$cache);
$cache = str_replace('"data":{"video_info":{"quality":', '"data":{"video_info":{"quality":'.QN.',"quality_fuck":', $cache);
$cache = str_replace('"data":{"playurl":{"quality":', '"data":{"playurl":{"quality":'.QN.',"quality_fuck":', $cache);
}
if ($cache != "") {
if (time() <= (int)$expired_time) {
@ -204,17 +204,17 @@ function get_cache_season() {
if (REDIS_ON) {
$redisConn = new redisFunc(REDIS_HOST,REDIS_PORT,REDIS_PASS);
if (EP_ID != "") {
if ($redisConn->check($area.'-season-'.$cache_type.'-0-'.EP_ID)){
@$cache = $redisConn->get($area.'-season-'.$cache_type.'-0-'.EP_ID);
@$expired_time = $redisConn->ttl($area.'-season-'.$cache_type.'-0-'.EP_ID)+time();
if ($redisConn -> check($area.'-season-'.$cache_type.'-0-'.EP_ID)){
@$cache = $redisConn -> get($area.'-season-'.$cache_type.'-0-'.EP_ID);
@$expired_time = $redisConn -> ttl($area.'-season-'.$cache_type.'-0-'.EP_ID)+time();
} else {
@$cache = "";
@$expired_time = time();
}
} elseif (SS_ID != "") {
if ($redisConn->check($area.'-season-'.$cache_type.'-0-'.EP_ID)){
@$cache = $redisConn->get($area.'-season-'.$cache_type.'-'.SS_ID.'-0');
@$expired_time = $redisConn->ttl($area.'-season-'.$cache_type.'-'.SS_ID.'-0')+time();
if ($redisConn -> check($area.'-season-'.$cache_type.'-0-'.EP_ID)){
@$cache = $redisConn -> get($area.'-season-'.$cache_type.'-'.SS_ID.'-0');
@$expired_time = $redisConn -> ttl($area.'-season-'.$cache_type.'-'.SS_ID.'-0')+time();
} else {
@$cache = "";
@$expired_time = time();
@ -223,17 +223,17 @@ function get_cache_season() {
if (!$cache) {
if ($area == "main") {
if (EP_ID != "") {
if ($redisConn->check($area.'-season-'.$cache_type.'-0-'.EP_ID)){
@$cache = $redisConn->get($area.'-season-'.$cache_type.'-0-'.EP_ID);
@$expired_time = $redisConn->ttl($area.'-season-'.$cache_type.'-0-'.EP_ID)+time();
if ($redisConn -> check($area.'-season-'.$cache_type.'-0-'.EP_ID)){
@$cache = $redisConn -> get($area.'-season-'.$cache_type.'-0-'.EP_ID);
@$expired_time = $redisConn -> ttl($area.'-season-'.$cache_type.'-0-'.EP_ID)+time();
} else {
@$cache = "";
@$expired_time = time();
}
} elseif (SS_ID != "") {
if ($redisConn->check($area.'-season-'.$cache_type.'-0-'.EP_ID)){
@$cache = $redisConn->get(AREA.'-season-'.$cache_type.'-'.SS_ID.'-0');
@$expired_time = $redisConn->ttl(AREA.'-season-'.$cache_type.'-'.SS_ID.'-0')+time();
if ($redisConn -> check($area.'-season-'.$cache_type.'-0-'.EP_ID)){
@$cache = $redisConn -> get(AREA.'-season-'.$cache_type.'-'.SS_ID.'-0');
@$expired_time = $redisConn -> ttl(AREA.'-season-'.$cache_type.'-'.SS_ID.'-0')+time();
} else {
@$cache = "";
@$expired_time = time();
@ -528,7 +528,7 @@ function get_cache_blacklist() {
$cres = $dbh -> query($sqlco);
$vnum = $cres -> fetch();
if (!$vnum) {
return ["⑨","⑨"];
return ["⑨", "⑨"];
}
//$uid = $vnum['uid'];
$expired_time = $vnum['expired_time'];
@ -536,7 +536,7 @@ function get_cache_blacklist() {
$is_whitelist = $vnum['is_whitelist'];
if (time() > (int)$expired_time) {
$refresh_cache_status = 1; // 刷新缓存
return ["⑨","⑨"];
return ["⑨", "⑨"];
}
return [$is_blacklist, $is_whitelist];
}
@ -586,7 +586,7 @@ function read_status($area){
}
//写入此次解析状态
function write_status($code,$area) {
function write_status($code, $area) {
global $dbh;
$result = $dbh -> query("SHOW TABLES LIKE 'status_code'");
$row = $result -> fetchAll();

@ -4,7 +4,7 @@ if(!defined('SYSTEM')) {exit();}
// 判断要转发的内容
$path = explode('/index.php', $_SERVER['PHP_SELF'])[0];
$query = str_replace("&&", "",str_replace("/&", "", $_SERVER['QUERY_STRING']));
$query = str_replace("&&", "", str_replace("/&", "", $_SERVER['QUERY_STRING']));
// 修复参数开头为 & 的问题
if (substr($query,0,1) == "&") {
$query = substr($query,1);
@ -53,7 +53,7 @@ define('QN', @$_GET['qn']);
define('BILIROAMING_VERSION', @$_SERVER['HTTP_X_FROM_BILIROAMING']);
define('BILIROAMING_VERSION_CODE', @$_SERVER['HTTP_BUILD']);
$baned = 0;
$th_paths = array("/intl/gateway/v2/app/search/type","/intl/gateway/v2/app/search/v2","/intl/gateway/v2/app/subtitle","/intl/gateway/web/v2/subtitle","/intl/gateway/v2/ogv/view/app/season","/intl/gateway/v2/ogv/view/app/season2","/intl/gateway/v2/ogv/playurl","/intl/gateway/v2/ogv/view/app/episode");
$th_paths = array("/intl/gateway/v2/app/search/type", "/intl/gateway/v2/app/search/v2", "/intl/gateway/v2/app/subtitle", "/intl/gateway/web/v2/subtitle", "/intl/gateway/v2/ogv/view/app/season", "/intl/gateway/v2/ogv/view/app/season2", "/intl/gateway/v2/ogv/playurl", "/intl/gateway/v2/ogv/view/app/episode");
$get_area = @$_GET['area'];
if (BILIROAMING_VERSION == '' && BILIROAMING_VERSION_CODE == '') {
if (BILIROAMING == 1 && WEB_ON == 0 && $path!="") { // 仅限漫游用户且未开放web脚本

@ -31,7 +31,7 @@ if ($httpcode == "301") {
// 转发到指定服务器
$url = CUSTOM_HOST_TH_TOKEN."/x/intl/passport-login/oauth2/refresh_token/index.php?".$PostData;
if (IP_RESOLVE == 1) {
$output2 = get_webpage($url,$host,$ip);
$output2 = get_webpage($url, $host, $ip);
} else {
$output2 = get_webpage($url);
}

@ -3,7 +3,7 @@
if(!defined('SYSTEM')) {exit();}
// 替换内容
$output = str_replace("\u0026","&",$output);
$output = str_replace("\u0026", "&", $output);
switch ($type) {
case 0: // 搜索
if ($cache_type != "web") {
@ -13,7 +13,7 @@ switch ($type) {
case 1: // playurl
break;
case 2: // 东南亚APP season
$output = str_replace('"vip":0','"vip":1',$output); // 支持漫游 #320
$output = str_replace('"vip":0', '"vip":1', $output); // 支持漫游 #320
if (AREA == "th") {
include (ROOT_PATH."utils/fuck_sub.php"); // 添加中文字幕
}

@ -85,7 +85,7 @@ function replace_playurl() {
// 发送内容
$output3 = json_encode($array2);
$output3 = str_replace("\/","/",$output3);
$output3 = str_replace("\/", "/", $output3);
exit($output3);
}
?>

@ -11,7 +11,7 @@ include (ROOT_PATH."utils/functions.php");
// 处理用户传入参数
include (ROOT_PATH."utils/process.php");
// 设置host
$host = get_host($type,$cache_type);
$host = get_host($type, $cache_type);
// 锁区、web接口、X-From-Biliroaming
include (ROOT_PATH."utils/lock_area.php");
// 鉴权、替换access_key、获取缓存
@ -26,7 +26,7 @@ $query = $add_query($type, $query, "");
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}

@ -11,7 +11,7 @@ include (ROOT_PATH."utils/functions.php");
// 处理用户传入参数
include (ROOT_PATH."utils/process.php");
// 设置host
$host = get_host($type,$cache_type);
$host = get_host($type, $cache_type);
// 锁区、web接口、X-From-Biliroaming
include (ROOT_PATH."utils/lock_area.php");
// 鉴权、替换access_key、获取缓存
@ -24,7 +24,7 @@ if (IP_RESOLVE == 1) {
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
$output = get_webpage($url, $host, $ip);
} else {
$output = get_webpage($url);
}

Loading…
Cancel
Save