MCPcopy Create free account
hub / github.com/Script-Hub-Org/Script-Hub / isBinaryMode

Function isBinaryMode

Rewrite-Parser.js:2144–2174  ·  view source on GitHub ↗
(url, name)

Source from the content-addressed store, hash-verified

2142
2143//查binary
2144async function isBinaryMode(url, name) {
2145 if (/proto/i.test(name)) {
2146 return 'true'
2147 } else if (/(?:tieba|youtube|bili|spotify|wyres|netease|DualSubs\.Subtitles\.Translate\.response)/i.test(url)) {
2148 if (binaryInfo.length > 0 && binaryInfo.some(item => item.url === url)) {
2149 for (let i = 0; i < binaryInfo.length; i++) {
2150 if (binaryInfo[i].url === url) {
2151 return binaryInfo[i].binarymode
2152 break
2153 }
2154 }
2155 } else {
2156 const res = (await http(url)).body
2157 if (res == undefined || res == null) {
2158 //$.log(JS_NAME);
2159 return ''
2160 } else if (res.includes('.bodyBytes')) {
2161 binaryInfo.push({ url, binarymode: 'true' })
2162
2163 $.setjson(binaryInfo, 'Parser_binary_info')
2164 return 'true'
2165 } else {
2166 binaryInfo.push({ url, binarymode: '' })
2167 $.setjson(binaryInfo, 'Parser_binary_info')
2168 return ''
2169 }
2170 } //没有信息或者没有url的信息
2171 } else {
2172 return ''
2173 }
2174} //查binary
2175
2176//获取mock参数
2177function getMockInfo(x, mark, y) {

Callers 1

Rewrite-Parser.jsFile · 0.70

Calls 2

httpFunction · 0.70
setjsonMethod · 0.45

Tested by

no test coverage detected