diff --git a/.DS_Store b/.DS_Store index 32cb939..d80de84 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Scripts/nf_ytb_ui-check.js b/Scripts/nf_ytb_ui-check.js new file mode 100644 index 0000000..ba859d4 --- /dev/null +++ b/Scripts/nf_ytb_ui-check.js @@ -0,0 +1,163 @@ +/*** + +Thanks to & modified from https://gist.githubusercontent.com/Hyseen/b06e911a41036ebc36acf04ddebe7b9a/raw/nf_check.js + +For Quantumult-X / + +[task_local] + +event-interaction https://raw.githubusercontent.com/KOP-XIAO/QuantumultX/master/Scripts/nf_ytb_ui-check.js, tag=YTB/NF 解锁查询, img-url=checkmark.seal.system, enabled=true + + + +@XIAO_KOP + +**/ + + +const BASE_URL = 'https://www.netflix.com/title/' +const BASE_URL_YTB = "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 policy_name = "Netflix" //填入你的 netflix 策略组名 + +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: '📺 NF/YTB 解锁查询', + content: '检测失败,请重试', + content1: '检测失败,请重试' + } + + await Promise.race([test(FILM_ID),timeOut(5000)]) + .then((code) => { + console.log(code) + + if (code === 'Not Available') { + result['content'] = '🛑 该节点未解锁 Netflix' + //return + //console.log(result) + } else if (code === 'Not Found') { + result['content'] = '⚠️ 该节点仅支持解锁 Netflix 自制剧' + //return + } else if (code === "timeout") { + result['content'] = "测试超时" + } else { + result['content'] = '✅ 该节点完整解锁 Netflix ➟ ⟦'+flags.get(code.toUpperCase())+" 地区⟧" + } + + return testYTB() +// $notify(result["title"], output, result["content"]+"\n"+result["content1"], link) +// $done({"title":result["title"],"message":result["content"]+"\n"+result["content1"]}) + }) + .then((code) => { + + console.log(code) + if (code === 'Not Available') { + result['content1'] = '⚠️ 该节点未解锁 YouTube Premium' + //return + } else if (code === "timeout") { + result['content1'] = "🛑 测试超时" + } else { + result['content1'] = "✅ 该节点已解锁 YouTube Premium" + } + $done({"title":result["title"],"message":"\n"+result["content"]+"\n\n"+result["content1"]}) + + }) +// ) +})() +.finally(() => $done()); + +function timeOut(delay) { + return new Promise((resolve, reject) => { + setTimeout(() => { + //reject(new Error('timeout')) + resolve("timeout") + }, delay) + }) +} + + +function test(filmId) { + return new Promise((resolve, reject) => { + let option = { + url: BASE_URL + filmId, + 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', + }, + } + $task.fetch(option).then (response => { + console.log(response.statusCode) + if (response.statusCode === 404) { + resolve('Not Found') + return + } + + if (response.statusCode === 403) { + resolve('Not Available') + return + } + + if (response.statusCode === 200) { + let url = response.headers['X-Originating-URL'] + let region = url.split('/')[3] + region = region.split('-')[0] + if (region == 'title') { + region = 'us' + } + resolve(region) + return + } + reject('Error') + }) + }) +} + +function testYTB() { + return new Promise((resolve, reject) => { + let option = { + url: BASE_URL_YTB, + 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' + }, + } + $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.split("countryCode")[1]) + 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) + }) + }) +} diff --git a/Scripts/resource-parser.js b/Scripts/resource-parser.js index b93f6fd..f89a03b 100644 --- a/Scripts/resource-parser.js +++ b/Scripts/resource-parser.js @@ -13,14 +13,13 @@ ☑︎ 用于禁用/修改远程引用中某(几)项 𝗿𝗲𝘄𝗿𝗶𝘁𝗲/𝗵𝗼𝘀𝘁𝗻𝗮𝗺𝗲/𝗳𝗶𝗹𝘁𝗲𝗿 ☑︎ 𝐒𝐮𝐫𝐠𝐞/𝐂𝐥𝐚𝐬𝐡 类型规则 𝗹𝗶𝘀𝘁 与 模块 𝐦𝐨𝐝𝐮𝐥𝐞 的解析使用 ---------------------------------------------------------- -0️⃣ 在 ⟦订阅链接⟧ 后加 "#" 使用, 不同参数用 "&" 连接: +0️⃣ 在 ⟦订阅链接⟧ 后加 "#" 使用, 不同参数用 "&" 连接 ⚠️ ☞ https://mysub.com#emoji=1&tfo=1&in=香港+台湾 ❖ 本地资源片段引用, 请将参数如 "#𝗶𝗻=𝘅𝘅𝘅." 填入文件第 ① 行 ❖ ❖ 🚦 支持中文, "操作" 以下特殊字符时请先替换 🚦 ∎ "+"⇒"%2B", 空格⇒"%20", "@"⇒"%40", "&"⇒"%26", "."⇒"\." 1️⃣ ⟦𝐬𝐞𝐫𝐯𝐞𝐫 节点⟧ ➠ 参数说明: -⦿ info=1, 开启通知提示机场 ✈️ 流量信息(如有提供); ⦿ emoji=1(国行设备用2)/-1, 添加/删除节点名内地区旗帜; ⦿ udp=1/-1, tfo=1/-1, 分别强制开启(关闭) 𝐮𝐝𝐩-𝐫𝐞𝐥𝐚𝐲/𝐟𝐚𝐬𝐭-𝐨𝐩𝐞𝐧; ⦿ tls13=1, cert=1, 分别开启 𝐭𝐥𝐬1.3 及 𝐭𝐥𝐬 证书验证(默认关闭); @@ -32,6 +31,10 @@ ❖ 删除字段: "字段1.字段2☠️", 想删除 "." 时用 "\." 替代 ❖ 示范: "rename=香港@𝐇𝐊+[𝐒𝐒]@+@[1𝐗]+流量.0\.2☠️" ❖ 默认 emoji 先生效, 如想调换顺序, 请用 𝗿𝗿𝗻𝗮𝗺𝗲 参数 +⦿ replace 正则替换节点中字段, 可用于重命名/更改加密方式等 + ❖ replace=regex1@𝘀𝘁𝗿1+regex2@𝘀𝘁𝗿2 + ❖ replace=𝗿𝗲𝗴𝗲𝘅1@ 则等效于 delreg 参数 +⦿ 占位符,可用于 rename/replace 等操作 ❖ $type0/1/2/3/4/5/6/7 占位符,将节点类型(ss/ssr/vmess 等)作为可操作参数,如 ∎ rename=@|$type2 ∎ 样式分别为 "𝐬𝐬","𝐒𝐒","🅢🅢","🆂🆂","ⓢⓢ","🅂🅂","𝕊𝕊","ˢˢ" @@ -46,13 +49,11 @@ ⦿ ptn=1-8, 将节点名中的英文替换成花样字 ⇒ 🅰/🄰/𝐀/𝗮/𝔸/𝕒/ᵃ/ᴬ ⦿ npt=1-8, 将节点名中的数字替换成花样数字 ⇒ ①\❶\⓵\𝟙\¹\₁\𝟏\𝟷 ⦿ delreg, 利用正则表达式来删除 "节点名" 中的字段(⚠️ 慎用) -⦿ replace 参数, 正则替换节点中内容, 可用于重命名/更改加密方式等 - ❖ replace=regex1@𝘀𝘁𝗿1+regex2@𝘀𝘁𝗿2 - ❖ replace=𝗿𝗲𝗴𝗲𝘅1@ 则等效于 𝗱𝗲𝗹𝗿𝗲𝗴 参数 ⦿ sort=1/-1/x/参数规则, 按节点名 正/逆/随机/参数规则 排序 ❖ 参数规则是正则表达式或简单关键词, 用"<" 或 ">" 连接 ❖ sort=🇭🇰>🇸🇬>🇯🇵>🇺🇸 , 靠前排序 ❖ sort=IEPL