mirror of https://github.com/NobyDa/Script.git
Fix some issues with Bili_Auto_Regions.js
This commit is contained in:
parent
18dd5361c8
commit
594d334359
|
@ -0,0 +1,13 @@
|
||||||
|
# 该规则集用于配合bilibili自动地区脚本使用。
|
||||||
|
host,api.biliapi.com,Bilibili
|
||||||
|
host,api.biliapi.net,Bilibili
|
||||||
|
host,api.bilibili.com,Bilibili
|
||||||
|
host,app.biliapi.com,Bilibili
|
||||||
|
host,app.biliapi.net,Bilibili
|
||||||
|
host,app.bilibili.com,Bilibili
|
||||||
|
host,grpc.biliapi.net,Bilibili
|
||||||
|
host,m.bilibili.com,Bilibili
|
||||||
|
host,upos-hz-mirrorakam.akamaized.net,Bilibili
|
||||||
|
host,www.bilibili.com,Bilibili
|
||||||
|
host-keyword,cn-hk-eq-bcache-,Bilibili
|
||||||
|
ip-cidr,121.11.192.0/24,Bilibili
|
|
@ -0,0 +1,13 @@
|
||||||
|
# 该规则集用于配合bilibili自动地区脚本使用。
|
||||||
|
DOMAIN,api.biliapi.com
|
||||||
|
DOMAIN,api.biliapi.net
|
||||||
|
DOMAIN,api.bilibili.com
|
||||||
|
DOMAIN,app.biliapi.com
|
||||||
|
DOMAIN,app.biliapi.net
|
||||||
|
DOMAIN,app.bilibili.com
|
||||||
|
DOMAIN,grpc.biliapi.net
|
||||||
|
DOMAIN,m.bilibili.com
|
||||||
|
DOMAIN,upos-hz-mirrorakam.akamaized.net
|
||||||
|
DOMAIN,www.bilibili.com
|
||||||
|
DOMAIN-KEYWORD,cn-hk-eq-bcache-
|
||||||
|
IP-CIDR,121.11.192.0/24,no-resolve
|
|
@ -5,7 +5,7 @@
|
||||||
如需禁用豆瓣评分或策略通知, 可前往BoxJs设置.
|
如需禁用豆瓣评分或策略通知, 可前往BoxJs设置.
|
||||||
BoxJs订阅地址: https://raw.githubusercontent.com/NobyDa/Script/master/NobyDa_BoxJs.json
|
BoxJs订阅地址: https://raw.githubusercontent.com/NobyDa/Script/master/NobyDa_BoxJs.json
|
||||||
|
|
||||||
Update: 2022.07.05
|
Update: 2022.07.29
|
||||||
Author: @NobyDa
|
Author: @NobyDa
|
||||||
Use: Surge, QuanX, Loon
|
Use: Surge, QuanX, Loon
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ Use: Surge, QuanX, Loon
|
||||||
|
|
||||||
您需要配置相关规则集:
|
您需要配置相关规则集:
|
||||||
Surge、Loon:
|
Surge、Loon:
|
||||||
https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/StreamingMedia/StreamingSE.list
|
https://raw.githubusercontent.com/NobyDa/Script/master/Surge/Bilibili.list
|
||||||
|
|
||||||
QuanX:
|
QuanX:
|
||||||
https://raw.githubusercontent.com/DivineEngine/Profiles/master/Quantumult/Filter/StreamingMedia/StreamingSE.list
|
https://raw.githubusercontent.com/NobyDa/Script/master/QuantumultX/Bilibili.list
|
||||||
|
|
||||||
绑定相关select或static策略组,并且需要具有相关的区域代理服务器纳入您的子策略中,子策略可以是服务器也可以是其他区域策略组.
|
绑定相关select或static策略组,并且需要具有相关的区域代理服务器纳入您的子策略中,子策略可以是服务器也可以是其他区域策略组.
|
||||||
最后,您可以通过BoxJs设置策略名和子策略名,或者手动填入脚本.
|
最后,您可以通过BoxJs设置策略名和子策略名,或者手动填入脚本.
|
||||||
|
@ -108,7 +108,7 @@ async function SwitchRegion(play) {
|
||||||
if (!notify) {
|
if (!notify) {
|
||||||
$.notify((/^(http|-404)/.test(play) || !play) ? `` : play, ``, msg);
|
$.notify((/^(http|-404)/.test(play) || !play) ? `` : play, ``, msg);
|
||||||
} else {
|
} else {
|
||||||
console.log(`${(/^(http|-404)/.test(play)||!play)?``:play}\n${msg}`);
|
console.log(`${(/^(http|-404)/.test(play) || !play) ? `` : play}\n${msg}`);
|
||||||
}
|
}
|
||||||
if (change) {
|
if (change) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -133,14 +133,15 @@ function SwitchStatus(status, original, newPolicy) {
|
||||||
|
|
||||||
function EnvInfo() {
|
function EnvInfo() {
|
||||||
const url = $request.url;
|
const url = $request.url;
|
||||||
if (typeof($response) !== 'undefined') {
|
if (typeof ($response) !== 'undefined') {
|
||||||
const raw = JSON.parse($response.body || "{}");
|
const raw = JSON.parse($response.body || "{}");
|
||||||
const data = raw.data || raw.result || {};
|
const data = raw.data || raw.result || {};
|
||||||
const t1 = (data.series && data.series.series_title) || data.title;
|
const t1 = [data.title, data.series && data.series.series_title, data.season_title]
|
||||||
|
.filter(c => /\u50c5[\u4e00-\u9fa5]+\u5340/.test(c))[0] || data.title;
|
||||||
const t2 = raw.code === -404 ? -404 : null;
|
const t2 = raw.code === -404 ? -404 : null;
|
||||||
SwitchRegion(t1 || t2)
|
SwitchRegion(t1 || t2)
|
||||||
.then(s => s ? $done({
|
.then(s => s ? $done({
|
||||||
status: $.isQuanX ? "HTTP/1.1 307" :307,
|
status: $.isQuanX ? "HTTP/1.1 307" : 307,
|
||||||
headers: {
|
headers: {
|
||||||
Location: url
|
Location: url
|
||||||
},
|
},
|
||||||
|
@ -172,12 +173,12 @@ async function QueryRating(body, play) {
|
||||||
.replace(/"\u53d7\u9650"/g, `""`).replace(/("area_limit":)1/g, '$10');
|
.replace(/"\u53d7\u9650"/g, `""`).replace(/("area_limit":)1/g, '$10');
|
||||||
body.data.modules = JSON.parse(limit);
|
body.data.modules = JSON.parse(limit);
|
||||||
body.data.detail = body.data.new_ep.desc.replace(/连载中,/, '');
|
body.data.detail = body.data.new_ep.desc.replace(/连载中,/, '');
|
||||||
body.data.badge_info.text = `⭐️ 豆瓣:${!$.is403?`${rating||'无评'}分 (${folk||'无评价'})`:`查询频繁!`}`;
|
body.data.badge_info.text = `⭐️ 豆瓣:${!$.is403 ? `${rating || '无评'}分 (${folk || '无评价'})` : `查询频繁!`}`;
|
||||||
body.data.evaluate = `${body.data.evaluate||''}\n\n豆瓣评分搜索结果: ${JSON.stringify(other,0,1)}`;
|
body.data.evaluate = `${body.data.evaluate || ''}\n\n豆瓣评分搜索结果: ${JSON.stringify(other, 0, 1)}`;
|
||||||
body.data.new_ep.desc = name;
|
body.data.new_ep.desc = name;
|
||||||
body.data.styles.unshift({
|
body.data.styles.unshift({
|
||||||
name: "⭐️ 点击此处打开豆瓣剧集详情页",
|
name: "⭐️ 点击此处打开豆瓣剧集详情页",
|
||||||
url: `https://m.douban.com/${id?`movie/subject/${id}/`:`search/?query=${encodeURI(play.title)}`}`
|
url: `https://m.douban.com/${id ? `movie/subject/${id}/` : `search/?query=${encodeURI(play.title)}`}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -257,7 +258,7 @@ function nobyda() {
|
||||||
const isQuanX = typeof $task != "undefined";
|
const isQuanX = typeof $task != "undefined";
|
||||||
const isSurge = typeof $network != "undefined" && typeof $script != "undefined";
|
const isSurge = typeof $network != "undefined" && typeof $script != "undefined";
|
||||||
const ssid = (() => {
|
const ssid = (() => {
|
||||||
if (isQuanX && typeof($environment) !== 'undefined') {
|
if (isQuanX && typeof ($environment) !== 'undefined') {
|
||||||
return $environment.ssid;
|
return $environment.ssid;
|
||||||
}
|
}
|
||||||
if (isSurge && $network.wifi) {
|
if (isSurge && $network.wifi) {
|
||||||
|
@ -287,7 +288,7 @@ function nobyda() {
|
||||||
}
|
}
|
||||||
const getPolicy = (groupName) => {
|
const getPolicy = (groupName) => {
|
||||||
if (isSurge) {
|
if (isSurge) {
|
||||||
if (typeof($httpAPI) === 'undefined') return 3;
|
if (typeof ($httpAPI) === 'undefined') return 3;
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
$httpAPI("GET", "v1/policy_groups/select", {
|
$httpAPI("GET", "v1/policy_groups/select", {
|
||||||
group_name: encodeURIComponent(groupName)
|
group_name: encodeURIComponent(groupName)
|
||||||
|
@ -295,12 +296,12 @@ function nobyda() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (isLoon) {
|
if (isLoon) {
|
||||||
if (typeof($config.getPolicy) === 'undefined') return 3;
|
if (typeof ($config.getPolicy) === 'undefined') return 3;
|
||||||
const getName = $config.getPolicy(groupName);
|
const getName = $config.getPolicy(groupName);
|
||||||
return getName || 2;
|
return getName || 2;
|
||||||
}
|
}
|
||||||
if (isQuanX) {
|
if (isQuanX) {
|
||||||
if (typeof($configuration) === 'undefined') return 3;
|
if (typeof ($configuration) === 'undefined') return 3;
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
$configuration.sendMessage({
|
$configuration.sendMessage({
|
||||||
action: "get_policy_state"
|
action: "get_policy_state"
|
||||||
|
@ -313,7 +314,7 @@ function nobyda() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const setPolicy = (group, policy) => {
|
const setPolicy = (group, policy) => {
|
||||||
if (isSurge && typeof($httpAPI) !== 'undefined') {
|
if (isSurge && typeof ($httpAPI) !== 'undefined') {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
$httpAPI("POST", "v1/policy_groups/select", {
|
$httpAPI("POST", "v1/policy_groups/select", {
|
||||||
group_name: group,
|
group_name: group,
|
||||||
|
@ -321,11 +322,11 @@ function nobyda() {
|
||||||
}, (b) => resolve(!b.error || 0))
|
}, (b) => resolve(!b.error || 0))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (isLoon && typeof($config.getPolicy) !== 'undefined') {
|
if (isLoon && typeof ($config.getPolicy) !== 'undefined') {
|
||||||
const set = $config.setSelectPolicy(group, policy);
|
const set = $config.setSelectPolicy(group, policy);
|
||||||
return set || 0;
|
return set || 0;
|
||||||
}
|
}
|
||||||
if (isQuanX && typeof($configuration) !== 'undefined') {
|
if (isQuanX && typeof ($configuration) !== 'undefined') {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
$configuration.sendMessage({
|
$configuration.sendMessage({
|
||||||
action: "set_policy_state",
|
action: "set_policy_state",
|
||||||
|
|
Loading…
Reference in New Issue