diff --git a/Scripts/geo_location.js b/Scripts/geo_location.js new file mode 100644 index 0000000..1645cca --- /dev/null +++ b/Scripts/geo_location.js @@ -0,0 +1,43 @@ + /*** + + For Quantumult-X 598+ + + [task_local] + event-interaction geo_location.js, tag=GeoIP 查询, img-url=location.fill.viewfinder.system + + @XIAO_KOP + + **/ + + var url = "https://api.ip.sb/geoip" + var opts = { + policy: $environment.params + }; + var myRequest = { + url: url, + opts: opts + }; + + var message = "" + const paras = ["ip","isp","country_code","city"] + const paran = ["IP","ISP","地区","城市"] + $task.fetch(myRequest).then(response => { + message = json2info(response.body,paras) + $done({"title":"🔎 IP.SB 查询结果","message":message}); + }, reason => { + message.appennd("🛑 查询失败") + $done({"title": "The Error Title", "message": message}); + }); + +function json2info(cnt,paras) { + var res = "----------------------\n" + cnt =JSON.parse(cnt) + for (i=0;i { console.log(code) if (code === 'Not Available') { - result['content'] = '该节点未解锁 Netflix' + result['content'] = '----------------------\n\n该节点未支持 Netflix' //return //console.log(result) } else if (code === 'Not Found') { - result['content'] = '该节点仅支持解锁 Netflix 自制剧' + result['content'] = '----------------------\n\n该节点仅支持 Netflix 自制剧' //return } else if (code === "timeout") { - result['content'] = "测试超时" + result['content'] = "----------------------\n\n测试超时" } else { - result['content'] = '该节点完整解锁 Netflix ➟ ⟦'+flags.get(code.toUpperCase())+" 地区⟧" + result['content'] = '----------------------\n\n该节点完整支持 Netflix ➟ ⟦'+flags.get(code.toUpperCase())+code.toUpperCase()+"⟧" } //$notify(result["title"], output, result["content"], link) diff --git a/Scripts/nf_ytb_ui-check.js b/Scripts/nf_ytb_ui-check.js index d5cc938..67a612b 100644 --- a/Scripts/nf_ytb_ui-check.js +++ b/Scripts/nf_ytb_ui-check.js @@ -2,7 +2,7 @@ Thanks to & modified from https://gist.githubusercontent.com/Hyseen/b06e911a41036ebc36acf04ddebe7b9a/raw/nf_check.js -For Quantumult-X / +For Quantumult-X 598+ [task_local] @@ -35,7 +35,7 @@ var flags = new Map([[ "AC" , "🇦🇨" ] , [ "AF" , "🇦🇫" ] , [ "AI" , " !(async () => { let result = { title: '📺 Netflix/YouTube 解锁查询', - content: '检测失败,请重试', + content: '----------------------\n\n检测失败,请重试', content1: '检测失败,请重试' } @@ -44,16 +44,16 @@ var flags = new Map([[ "AC" , "🇦🇨" ] , [ "AF" , "🇦🇫" ] , [ "AI" , " console.log(code) if (code === 'Not Available') { - result['content'] = '🛑 该节点未解锁 Netflix' + result['content'] = '----------------------\n\n🛑 该节点未支持 Netflix' //return //console.log(result) } else if (code === 'Not Found') { - result['content'] = '⚠️ 该节点仅支持解锁 Netflix 自制剧' + result['content'] = '----------------------\n\n⚠️ 该节点仅支持 Netflix 自制剧' //return } else if (code === "timeout") { - result['content'] = "测试超时" + result['content'] = "----------------------\n\n测试超时" } else { - result['content'] = '✅ 该节点完整解锁 Netflix ➟ ⟦'+flags.get(code.toUpperCase())+" 地区⟧" + result['content'] = '----------------------\n\n✅ 该节点完整支持 Netflix ➟ ⟦'+flags.get(code.toUpperCase())+code.toUpperCase()+"⟧" } return testYTB() @@ -64,14 +64,14 @@ var flags = new Map([[ "AC" , "🇦🇨" ] , [ "AF" , "🇦🇫" ] , [ "AI" , " console.log(code) if (code === 'Not Available') { - result['content1'] = '⚠️ 该节点未解锁 YouTube Premium' + result['content1'] = '⚠️ 该节点未支持 YouTube Premium' //return } else if (code === "timeout") { result['content1'] = "🛑 测试超时" } else { - result['content1'] = "✅ 该节点已解锁 YouTube Premium" + result['content1'] = "✅ 该节点支持 YouTube Premium" } - $done({"title":result["title"],"message":"\n"+result["content"]+"\n\n"+result["content1"]}) + $done({"title":result["title"],"message":result["content"]+"\n\n"+result["content1"]}) }) // ) diff --git a/Scripts/ytb-ui-check.js b/Scripts/ytb-ui-check.js new file mode 100644 index 0000000..7f23146 --- /dev/null +++ b/Scripts/ytb-ui-check.js @@ -0,0 +1,103 @@ +/*** + +Thanks to & modified from https://gist.githubusercontent.com/Hyseen/b06e911a41036ebc36acf04ddebe7b9a/raw/nf_check.js + +For Quantumult-X 598+ + +[task_local] + +event-interaction https://raw.githubusercontent.com/KOP-XIAO/QuantumultX/master/Scripts/ytb-ui-check.js, tag=YouTube 查询, img-url=text.magnifyingglass.system, enabled=true + +@XIAO_KOP + +**/ + + +const BASE_URL = 'https://www.youtube.com/premium' + +const FILM_ID = 81215567 +const link = { "media-url": "https://raw.githubusercontent.com/KOP-XIAO/QuantumultX/master/img/southpark/7.png" } + +const arrow = "➟" +var output = "" +var opts = { + policy: $environment.params +}; + + +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" , "🇿🇦"]]) + + +!(async () => { + let result = { + title: '📺 YouTube Premium 检测', + content: '----------------------\n\n检测失败,请重试', + } + await Promise.race([test(FILM_ID),timeOut(5000)]) + .then((code) => { + console.log(code) + + if (code === 'Not Available') { + result['content'] = '----------------------\n\n🛑 该节点未支持 YouTube Premium' + //return + } else if (code === "timeout") { + result['content'] = "----------------------\n\n🚦 测试超时" + } else { + result['content'] = '----------------------\n\n✅ 该节点支持 YouTube Premium ' + } + //$notify(result["title"], output, result["content"], link) + + //console.log(result) + $done({"title":result["title"],"message":result["content"]}) + }) +})() +.finally(() => $done()); + +function timeOut(delay) { + return new Promise((resolve, reject) => { + setTimeout(() => { + //reject(new Error('timeout')) + resolve("timeout") + }, delay) + }) +} + + +function test() { + return new Promise((resolve, reject) => { + let option = { + url: BASE_URL, + opts: opts, + headers: { + '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', + 'Accept-Language': 'en', + }, + } + $task.fetch(option).then(response=> { + let data = response.body + console.log(response.statusCode) + if (response.statusCode !== 200) { + reject('Error') + return + } + + if (data.indexOf('Premium is not available in your country') !== -1) { + resolve('Not Available') + return + } + console.log(data) + let region = '' + let re = new RegExp('"countryCode":"(.*?)"', 'gm') + let result = re.exec(data) + if (result != null && result.length === 2) { + region = result[1] + } else if (data.indexOf('www.google.cn') !== -1) { + region = 'CN' + } else { + region = 'US' + } + resolve(region) + }) + }) +}