mirror of
https://github.com/KOP-XIAO/QuantumultX.git
synced 2026-01-26 05:45:09 +00:00
timeout
This commit is contained in:
@@ -1,7 +1,4 @@
|
|||||||
/***
|
/***
|
||||||
|
|
||||||
For Quantumult-X 598+
|
|
||||||
|
|
||||||
[task_local]
|
[task_local]
|
||||||
event-interaction geo_location.js, tag=GeoIP 查询, img-url=location.fill.viewfinder.system
|
event-interaction geo_location.js, tag=GeoIP 查询, img-url=location.fill.viewfinder.system
|
||||||
|
|
||||||
@@ -15,19 +12,21 @@
|
|||||||
};
|
};
|
||||||
var myRequest = {
|
var myRequest = {
|
||||||
url: url,
|
url: url,
|
||||||
opts: opts
|
opts: opts,
|
||||||
|
timeout: 4000
|
||||||
};
|
};
|
||||||
|
|
||||||
var message = ""
|
var message = ""
|
||||||
const paras = ["ip","isp","country_code","city"]
|
const paras = ["ip","isp","country_code","city"]
|
||||||
const paran = ["IP","ISP","地区","城市"]
|
const paran = ["IP","ISP","地区","城市"]
|
||||||
$task.fetch(myRequest).then(response => {
|
$task.fetch(myRequest).then(response => {
|
||||||
message = json2info(response.body,paras)
|
message = response? json2info(response.body,paras) : ""
|
||||||
$done({"title":"🔎 IP.SB 查询结果","message":message});
|
$done({"title":"🔎 IP.SB 查询结果","message":message});
|
||||||
}, reason => {
|
}, reason => {
|
||||||
message.appennd("🛑 查询失败")
|
message = "\n\n🛑 查询超时"
|
||||||
$done({"title": "The Error Title", "message": message});
|
$done({"title": "🔎 IP.SB 查询结果", "message": message});
|
||||||
});
|
})
|
||||||
|
|
||||||
|
|
||||||
function json2info(cnt,paras) {
|
function json2info(cnt,paras) {
|
||||||
var res = "----------------------\n"
|
var res = "----------------------\n"
|
||||||
@@ -40,4 +39,5 @@ function json2info(cnt,paras) {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var flags = new Map([[ "AC" , "🇦🇨" ] , [ "AF" , "🇦🇫" ] , [ "AI" , "🇦🇮" ] , [ "AL" , "🇦🇱" ] , [ "AM" , "🇦🇲" ] , [ "AQ" , "🇦🇶" ] , [ "AR" , "🇦🇷" ] , [ "AS" , "🇦🇸" ] , [ "AT" , "🇦🇹" ] , [ "AU" , "🇦🇺" ] , [ "AW" , "🇦🇼" ] , [ "AX" , "🇦🇽" ] , [ "AZ" , "🇦🇿" ] , [ "BB" , "🇧🇧" ] , [ "BD" , "🇧🇩" ] , [ "BE" , "🇧🇪" ] , [ "BF" , "🇧🇫" ] , [ "BG" , "🇧🇬" ] , [ "BH" , "🇧🇭" ] , [ "BI" , "🇧🇮" ] , [ "BJ" , "🇧🇯" ] , [ "BM" , "🇧🇲" ] , [ "BN" , "🇧🇳" ] , [ "BO" , "🇧🇴" ] , [ "BR" , "🇧🇷" ] , [ "BS" , "🇧🇸" ] , [ "BT" , "🇧🇹" ] , [ "BV" , "🇧🇻" ] , [ "BW" , "🇧🇼" ] , [ "BY" , "🇧🇾" ] , [ "BZ" , "🇧🇿" ] , [ "CA" , "🇨🇦" ] , [ "CF" , "🇨🇫" ] , [ "CH" , "🇨🇭" ] , [ "CK" , "🇨🇰" ] , [ "CL" , "🇨🇱" ] , [ "CM" , "🇨🇲" ] , [ "CN" , "🇨🇳" ] , [ "CO" , "🇨🇴" ] , [ "CP" , "🇨🇵" ] , [ "CR" , "🇨🇷" ] , [ "CU" , "🇨🇺" ] , [ "CV" , "🇨🇻" ] , [ "CW" , "🇨🇼" ] , [ "CX" , "🇨🇽" ] , [ "CY" , "🇨🇾" ] , [ "CZ" , "🇨🇿" ] , [ "DE" , "🇩🇪" ] , [ "DG" , "🇩🇬" ] , [ "DJ" , "🇩🇯" ] , [ "DK" , "🇩🇰" ] , [ "DM" , "🇩🇲" ] , [ "DO" , "🇩🇴" ] , [ "DZ" , "🇩🇿" ] , [ "EA" , "🇪🇦" ] , [ "EC" , "🇪🇨" ] , [ "EE" , "🇪🇪" ] , [ "EG" , "🇪🇬" ] , [ "EH" , "🇪🇭" ] , [ "ER" , "🇪🇷" ] , [ "ES" , "🇪🇸" ] , [ "ET" , "🇪🇹" ] , [ "EU" , "🇪🇺" ] , [ "FI" , "🇫🇮" ] , [ "FJ" , "🇫🇯" ] , [ "FK" , "🇫🇰" ] , [ "FM" , "🇫🇲" ] , [ "FO" , "🇫🇴" ] , [ "FR" , "🇫🇷" ] , [ "GA" , "🇬🇦" ] , [ "GB" , "🇬🇧" ] , [ "HK" , "🇭🇰" ] ,["HU","🇭🇺"], [ "ID" , "🇮🇩" ] , [ "IE" , "🇮🇪" ] , [ "IL" , "🇮🇱" ] , [ "IM" , "🇮🇲" ] , [ "IN" , "🇮🇳" ] , [ "IS" , "🇮🇸" ] , [ "IT" , "🇮🇹" ] , [ "JP" , "🇯🇵" ] , [ "KR" , "🇰🇷" ] , [ "LU" , "🇱🇺" ] , [ "MO" , "🇲🇴" ] , [ "MX" , "🇲🇽" ] , [ "MY" , "🇲🇾" ] , [ "NL" , "🇳🇱" ] , [ "PH" , "🇵🇭" ] , [ "RO" , "🇷🇴" ] , [ "RS" , "🇷🇸" ] , [ "RU" , "🇷🇺" ] , [ "RW" , "🇷🇼" ] , [ "SA" , "🇸🇦" ] , [ "SB" , "🇸🇧" ] , [ "SC" , "🇸🇨" ] , [ "SD" , "🇸🇩" ] , [ "SE" , "🇸🇪" ] , [ "SG" , "🇸🇬" ] , [ "TH" , "🇹🇭" ] , [ "TN" , "🇹🇳" ] , [ "TO" , "🇹🇴" ] , [ "TR" , "🇹🇷" ] , [ "TV" , "🇹🇻" ] , [ "TW" , "🇨🇳" ] , [ "UK" , "🇬🇧" ] , [ "UM" , "🇺🇲" ] , [ "US" , "🇺🇸" ] , [ "UY" , "🇺🇾" ] , [ "UZ" , "🇺🇿" ] , [ "VA" , "🇻🇦" ] , [ "VE" , "🇻🇪" ] , [ "VG" , "🇻🇬" ] , [ "VI" , "🇻🇮" ] , [ "VN" , "🇻🇳" ] , [ "ZA" , "🇿🇦"]])
|
var flags = new Map([[ "AC" , "🇦🇨" ] , [ "AF" , "🇦🇫" ] , [ "AI" , "🇦🇮" ] , [ "AL" , "🇦🇱" ] , [ "AM" , "🇦🇲" ] , [ "AQ" , "🇦🇶" ] , [ "AR" , "🇦🇷" ] , [ "AS" , "🇦🇸" ] , [ "AT" , "🇦🇹" ] , [ "AU" , "🇦🇺" ] , [ "AW" , "🇦🇼" ] , [ "AX" , "🇦🇽" ] , [ "AZ" , "🇦🇿" ] , [ "BB" , "🇧🇧" ] , [ "BD" , "🇧🇩" ] , [ "BE" , "🇧🇪" ] , [ "BF" , "🇧🇫" ] , [ "BG" , "🇧🇬" ] , [ "BH" , "🇧🇭" ] , [ "BI" , "🇧🇮" ] , [ "BJ" , "🇧🇯" ] , [ "BM" , "🇧🇲" ] , [ "BN" , "🇧🇳" ] , [ "BO" , "🇧🇴" ] , [ "BR" , "🇧🇷" ] , [ "BS" , "🇧🇸" ] , [ "BT" , "🇧🇹" ] , [ "BV" , "🇧🇻" ] , [ "BW" , "🇧🇼" ] , [ "BY" , "🇧🇾" ] , [ "BZ" , "🇧🇿" ] , [ "CA" , "🇨🇦" ] , [ "CF" , "🇨🇫" ] , [ "CH" , "🇨🇭" ] , [ "CK" , "🇨🇰" ] , [ "CL" , "🇨🇱" ] , [ "CM" , "🇨🇲" ] , [ "CN" , "🇨🇳" ] , [ "CO" , "🇨🇴" ] , [ "CP" , "🇨🇵" ] , [ "CR" , "🇨🇷" ] , [ "CU" , "🇨🇺" ] , [ "CV" , "🇨🇻" ] , [ "CW" , "🇨🇼" ] , [ "CX" , "🇨🇽" ] , [ "CY" , "🇨🇾" ] , [ "CZ" , "🇨🇿" ] , [ "DE" , "🇩🇪" ] , [ "DG" , "🇩🇬" ] , [ "DJ" , "🇩🇯" ] , [ "DK" , "🇩🇰" ] , [ "DM" , "🇩🇲" ] , [ "DO" , "🇩🇴" ] , [ "DZ" , "🇩🇿" ] , [ "EA" , "🇪🇦" ] , [ "EC" , "🇪🇨" ] , [ "EE" , "🇪🇪" ] , [ "EG" , "🇪🇬" ] , [ "EH" , "🇪🇭" ] , [ "ER" , "🇪🇷" ] , [ "ES" , "🇪🇸" ] , [ "ET" , "🇪🇹" ] , [ "EU" , "🇪🇺" ] , [ "FI" , "🇫🇮" ] , [ "FJ" , "🇫🇯" ] , [ "FK" , "🇫🇰" ] , [ "FM" , "🇫🇲" ] , [ "FO" , "🇫🇴" ] , [ "FR" , "🇫🇷" ] , [ "GA" , "🇬🇦" ] , [ "GB" , "🇬🇧" ] , [ "HK" , "🇭🇰" ] ,["HU","🇭🇺"], [ "ID" , "🇮🇩" ] , [ "IE" , "🇮🇪" ] , [ "IL" , "🇮🇱" ] , [ "IM" , "🇮🇲" ] , [ "IN" , "🇮🇳" ] , [ "IS" , "🇮🇸" ] , [ "IT" , "🇮🇹" ] , [ "JP" , "🇯🇵" ] , [ "KR" , "🇰🇷" ] , [ "LU" , "🇱🇺" ] , [ "MO" , "🇲🇴" ] , [ "MX" , "🇲🇽" ] , [ "MY" , "🇲🇾" ] , [ "NL" , "🇳🇱" ] , [ "PH" , "🇵🇭" ] , [ "RO" , "🇷🇴" ] , [ "RS" , "🇷🇸" ] , [ "RU" , "🇷🇺" ] , [ "RW" , "🇷🇼" ] , [ "SA" , "🇸🇦" ] , [ "SB" , "🇸🇧" ] , [ "SC" , "🇸🇨" ] , [ "SD" , "🇸🇩" ] , [ "SE" , "🇸🇪" ] , [ "SG" , "🇸🇬" ] , [ "TH" , "🇹🇭" ] , [ "TN" , "🇹🇳" ] , [ "TO" , "🇹🇴" ] , [ "TR" , "🇹🇷" ] , [ "TV" , "🇹🇻" ] , [ "TW" , "🇨🇳" ] , [ "UK" , "🇬🇧" ] , [ "UM" , "🇺🇲" ] , [ "US" , "🇺🇸" ] , [ "UY" , "🇺🇾" ] , [ "UZ" , "🇺🇿" ] , [ "VA" , "🇻🇦" ] , [ "VE" , "🇻🇪" ] , [ "VG" , "🇻🇬" ] , [ "VI" , "🇻🇮" ] , [ "VN" , "🇻🇳" ] , [ "ZA" , "🇿🇦"]])
|
||||||
|
|||||||
@@ -33,23 +33,23 @@ var flags = new Map([[ "AC" , "🇦🇨" ] , [ "AF" , "🇦🇫" ] , [ "AI" , "
|
|||||||
let result = {
|
let result = {
|
||||||
title: 'Netflix 解锁检测',
|
title: 'Netflix 解锁检测',
|
||||||
subtitle: output,
|
subtitle: output,
|
||||||
content: '----------------------\n\n检测失败,请重试',
|
content: '检测失败,请重试',
|
||||||
}
|
}
|
||||||
await Promise.race([test(FILM_ID),timeOut(5000)])
|
await Promise.race([test(FILM_ID),timeOut(5000)])
|
||||||
.then((code) => {
|
.then((code) => {
|
||||||
console.log(code)
|
console.log(code)
|
||||||
|
|
||||||
if (code === 'Not Available') {
|
if (code === 'Not Available') {
|
||||||
result['content'] = '----------------------\n\n该节点未支持 Netflix'
|
result['content'] = '该节点未解锁 Netflix'
|
||||||
//return
|
//return
|
||||||
//console.log(result)
|
//console.log(result)
|
||||||
} else if (code === 'Not Found') {
|
} else if (code === 'Not Found') {
|
||||||
result['content'] = '----------------------\n\n该节点仅支持 Netflix 自制剧'
|
result['content'] = '该节点仅支持解锁 Netflix 自制剧'
|
||||||
//return
|
//return
|
||||||
} else if (code === "timeout") {
|
} else if (code === "timeout") {
|
||||||
result['content'] = "----------------------\n\n测试超时"
|
result['content'] = "测试超时"
|
||||||
} else {
|
} else {
|
||||||
result['content'] = '----------------------\n\n该节点完整支持 Netflix ➟ ⟦'+flags.get(code.toUpperCase())+code.toUpperCase()+"⟧"
|
result['content'] = '该节点完整解锁 Netflix ➟ ⟦'+flags.get(code.toUpperCase())+" 地区⟧"
|
||||||
}
|
}
|
||||||
|
|
||||||
//$notify(result["title"], output, result["content"], link)
|
//$notify(result["title"], output, result["content"], link)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ var flags = new Map([[ "AC" , "🇦🇨" ] , [ "AF" , "🇦🇫" ] , [ "AI" , "
|
|||||||
result['content'] = '----------------------\n\n⚠️ 仅支持 Netflix 自制剧'
|
result['content'] = '----------------------\n\n⚠️ 仅支持 Netflix 自制剧'
|
||||||
//return
|
//return
|
||||||
} else if (code === "timeout") {
|
} else if (code === "timeout") {
|
||||||
result['content'] = "----------------------\n\n测试超时"
|
result['content'] = "----------------------\n\n🛑 测试超时"
|
||||||
} else {
|
} else {
|
||||||
result['content'] = '----------------------\n\n✅ 完整支持 Netflix ➟ ⟦'+flags.get(code.toUpperCase())+code.toUpperCase()+"⟧"
|
result['content'] = '----------------------\n\n✅ 完整支持 Netflix ➟ ⟦'+flags.get(code.toUpperCase())+code.toUpperCase()+"⟧"
|
||||||
}
|
}
|
||||||
@@ -93,6 +93,7 @@ function test(filmId) {
|
|||||||
let option = {
|
let option = {
|
||||||
url: BASE_URL + filmId,
|
url: BASE_URL + filmId,
|
||||||
opts: opts,
|
opts: opts,
|
||||||
|
timeout: 4000,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent':
|
'User-Agent':
|
||||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36',
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36',
|
||||||
@@ -121,7 +122,11 @@ function test(filmId) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
reject('Error')
|
reject('Error')
|
||||||
})
|
}, reason => {
|
||||||
|
resolve("timeout")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,6 +135,7 @@ function testYTB() {
|
|||||||
let option = {
|
let option = {
|
||||||
url: BASE_URL_YTB,
|
url: BASE_URL_YTB,
|
||||||
opts: opts,
|
opts: opts,
|
||||||
|
timeout: 4000,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent':
|
'User-Agent':
|
||||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36'
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36'
|
||||||
@@ -159,6 +165,8 @@ function testYTB() {
|
|||||||
region = 'US'
|
region = 'US'
|
||||||
}
|
}
|
||||||
resolve(region)
|
resolve(region)
|
||||||
|
}, reason => {
|
||||||
|
resolve("timeout")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user