MCPcopy Create free account
hub / github.com/NobyDa/Script / EnvInfo

Function EnvInfo

Surge/JS/Bili_Auto_Regions.js:133–154  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

131}
132
133function EnvInfo() {
134 const url = $request.url;
135 if (typeof ($response) !== 'undefined') {
136 const raw = JSON.parse($response.body || "{}");
137 const data = raw.data || raw.result || {};
138 const title = [data.title, data.series && data.series.series_title, data.season_title]
139 .filter(c => /\u5340\uff09/.test(c))[0] || data.title;
140 SwitchRegion(title, null, raw)
141 .then(s => s ? $done({
142 status: $.isQuanX ? "HTTP/1.1 307" : 307,
143 headers: {
144 Location: url
145 },
146 body: "{}"
147 }) : QueryRating(raw, data));
148 } else {
149 const res = {
150 url: url.replace(/%20(%E6%B8%AF|%E5%8F%B0|%E4%B8%AD)&/g, '&')
151 };
152 SwitchRegion(null, url, {}).then(() => $done(res));
153 }
154}
155
156async function QueryRating(body, play) {
157 try {

Callers 1

Calls 2

SwitchRegionFunction · 0.85
QueryRatingFunction · 0.85

Tested by

no test coverage detected