1. 有 access_key 但没开缓存,只会在需要时检查用户
2. 替换泰区 aid 及 cid
3. 替换泰区字幕支持 season2
4. 修改部分必要参数
pull/32/head
david082321 3 years ago committed by GitHub
parent 463a5cc018
commit 688491a068
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -110,6 +110,10 @@ define('IP_RESOLVE', 0); // 开启功能。0 否, 1 是
$ips = array('172.0.0.1', '192.168.0.1', '1.2.3.4');
$hosts = array('workers.dev', 'workers.dev');
// 替换泰区 aid (评论投币) / cid (弹幕)
define('TH_AID', 0);
define('TH_CID', 0);
// 其他
define('WELCOME', "file"); // 首页画面。text 文字, file 加载文件
define('WELCOME_TEXT', "Success! Power by BiliRoaming-PHP-Server."); // 首页欢迎语

@ -31,7 +31,7 @@ if (IP_RESOLVE == 1) {
$ip = $ips[array_rand($ips)];
}
// 加入必要参数
$query = add_query("th", $query, "fnver=0&fnval=464&fourk=1&platform=android&s_locale=zh_SG&qn=125&ts=".time());
$query = add_query("th", $query, "fnver=0&fnval=4048&fourk=1&platform=android&s_locale=zh_SG&qn=125&ts=".time());
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {

@ -31,7 +31,7 @@ if (IP_RESOLVE == 1) {
$ip = $ips[array_rand($ips)];
}
// 加入必要参数
$query = add_query("cn", $query, "fnver=0&fnval=464&fourk=1&platform=android&qn=125&ts=".time());
$query = add_query("cn", $query, "fnver=0&fnval=4048&fourk=1&platform=android&qn=125&ts=".time());
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {

@ -31,7 +31,7 @@ if (IP_RESOLVE == 1) {
$ip = $ips[array_rand($ips)];
}
// 加入必要参数
$query = add_query("cn", $query, "fnver=0&fnval=464&fourk=1&qn=125&ts=".time());
$query = add_query("cn", $query, "fnver=0&fnval=4048&fourk=1&qn=125&ts=".time());
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {

@ -37,11 +37,14 @@ if (ACCESS_KEY != "" && SAVE_CACHE == 1) {
block(20, "访问密钥已过期或不存在(脚本设置左下角重新授权)");
}
} elseif (ACCESS_KEY != "") {
$out = get_userinfo();
$uid = $out[0];
$due = $out[1];
if ($uid == "0" && NEED_LOGIN == 1) {
block(20, "访问密钥已过期或不存在(脚本设置左下角重新授权)");
// 有 access_key 但没开缓存,只会在需要时检查用户
if (NEED_LOGIN == 1 || (BLOCK_TYPE == "blacklist" || BLOCK_TYPE == "whitelist" || BLOCK_TYPE == "local_blacklist" || BLOCK_TYPE == "local_whitelist" )) {
$out = get_userinfo();
$uid = $out[0];
$due = $out[1];
if ($uid == "0") {
block(20, "访问密钥已过期或不存在(脚本设置左下角重新授权)");
}
}
}
@ -125,7 +128,7 @@ if (ACCESS_KEY != "") { // access_key 存在
}
} else { // access_key 不存在
if (CID == "13073143" || CID == "120453316") { // 漫游测速
//pass
// pass
} elseif (BLOCK_TYPE == "whitelist" || BLOCK_TYPE == "local_whitelist" || NEED_LOGIN == 1) { // 白名单模式 或 黑名单模式+需要登录
block(23, "未提供访问密钥(漫游需要登录、脚本需要授权)");
}

@ -2,36 +2,71 @@
$array = json_decode($output, true);
$code = $array['code'];
if ($code == "0" || $code == 0) {
$ss_id = $array['result']['season_id'];
$url = SUBTITLE_API.$ss_id;
$replace_json = get_webpage($url);
$replace_array = json_decode($replace_json, true);
$code = $replace_array['code'];
if ($code == "0") {
$replace = $replace_array['data'];
$items = $array['result']['modules'][0]['data']['episodes'];
$count = count($items);
for ($i=0; $i<count($replace); $i++) {
$ep = $replace[$i]['ep'];
$key = $replace[$i]['key'];
$lang = $replace[$i]['lang'];
$url = $replace[$i]['url'];
if ($ep < $count) {
$sub_arr = $array['result']['modules'][0]['data']['episodes'][$ep]['subtitles'];
$sub_count = count($sub_arr);
$add_arr = array(
"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['result']['modules'][0]['data']['episodes'][$ep]['subtitles'] = $sub_arr;
// 替换 aid 及 cid
$episodes_items = $array['result']['modules'][0]['data']['episodes'];
for ($i=0; $i<count($episodes_items); $i++) {
$array['result']['modules'][0]['data']['episodes'][$i]['aid'] = TH_AID;
$array['result']['modules'][0]['data']['episodes'][$i]['cid'] = TH_CID;
}
// 判断 season 内容
if (count($array['result']) > 0) {
$ss_type = "result";
} elseif (count($array['data']) > 0) {
$ss_type = "data";
} else {
$ss_type = "";
}
// 下载要替换的字幕
if (SUBTITLE_API != 'https://example.com/path?season_id=') {
if ($ss_type == "result") {
$ss_id = $array['result']['season_id'];
} else {
$ss_id = $array['data']['season_id'];
}
$url = SUBTITLE_API.$ss_id;
$replace_json = get_webpage($url);
$replace_array = json_decode($replace_json, true);
$code = $replace_array['code'];
// 替换字幕
if ($code == "0") {
$replace = $replace_array['data'];
if ($ss_type == "result") {
$items = $array['result']['modules'][0]['data']['episodes'];
} else {
$items = $array['data']['sections']['section'][0]['ep_details'];
}
$count = count($items);
for ($i=0; $i<count($replace); $i++) {
$ep = $replace[$i]['ep'];
$key = $replace[$i]['key'];
$lang = $replace[$i]['lang'];
$url = $replace[$i]['url'];
if ($ep < $count) {
if ($ss_type == "result") {
$sub_arr = $array['result']['modules'][0]['data']['episodes'][$ep]['subtitles'];
} else {
$sub_arr = $array['data']['sections']['section'][0]['ep_details'][$ep]['subtitles'];
}
$sub_count = count($sub_arr);
$add_arr = array(
"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); //这个会放在后面
if ($ss_type == "result") {
$array['result']['modules'][0]['data']['episodes'][$ep]['subtitles'] = $sub_arr;
} else {
$array['data']['sections']['section'][0]['ep_details'][$ep]['subtitles'] = $sub_arr;
}
}
}
}
$output = json_encode($array, JSON_UNESCAPED_UNICODE);
}
$output = json_encode($array, JSON_UNESCAPED_UNICODE);
}
?>

Loading…
Cancel
Save