ChatGPT check support

This commit is contained in:
Shawn
2023-02-14 20:02:26 +08:00
parent 229b83f38b
commit b7b7259246

View File

@@ -4,11 +4,13 @@ Thanks to & modified from
1. https://gist.githubusercontent.com/Hyseen/b06e911a41036ebc36acf04ddebe7b9a/raw/nf_check.js 1. https://gist.githubusercontent.com/Hyseen/b06e911a41036ebc36acf04ddebe7b9a/raw/nf_check.js
2. https://github.com/AtlantisGawrGura/Quantumult-X-Scripts/blob/main/media.js 2. https://github.com/AtlantisGawrGura/Quantumult-X-Scripts/blob/main/media.js
3. https://github.com/CoiaPrant/MediaUnlock_Test/blob/main/check.sh 3. https://github.com/CoiaPrant/MediaUnlock_Test/blob/main/check.sh
3. https://github.com/Netflixxp/chatGPT/blob/main/chat.sh
For Quantumult-X 598+ ONLY!! For Quantumult-X 598+ ONLY!!
2022-12-16 2023-02-14
- 支持 ChatGPT 检测
[task_local] [task_local]
@@ -26,6 +28,8 @@ const BASE_URL_Param = "https://www.paramountplus.com/"
const FILM_ID = 80062035 const FILM_ID = 80062035
const BASE_URL_Discovery_token = "https://us1-prod-direct.discoveryplus.com/token?deviceId=d1a4a5d25212400d1e6985984604d740&realm=go&shortlived=true" const BASE_URL_Discovery_token = "https://us1-prod-direct.discoveryplus.com/token?deviceId=d1a4a5d25212400d1e6985984604d740&realm=go&shortlived=true"
const BASE_URL_Discovery = "https://us1-prod-direct.discoveryplus.com/users/me" const BASE_URL_Discovery = "https://us1-prod-direct.discoveryplus.com/users/me"
const BASE_URL_GPT = 'https://chat.openai.com/'
const Region_URL_GPT = 'https://chat.openai.com/cdn-cgi/trace'
const link = { "media-url": "https://raw.githubusercontent.com/KOP-XIAO/QuantumultX/master/img/southpark/7.png" } const link = { "media-url": "https://raw.githubusercontent.com/KOP-XIAO/QuantumultX/master/img/southpark/7.png" }
const policy_name = "Netflix" //填入你的 netflix 策略组名 const policy_name = "Netflix" //填入你的 netflix 策略组名
@@ -65,6 +69,7 @@ let result = {
"Disney": "<b>Disneyᐩ: </b>检测失败,请重试 ❗️", "Disney": "<b>Disneyᐩ: </b>检测失败,请重试 ❗️",
"Paramount" : "<b>Paramountᐩ: </b>检测失败,请重试 ❗️", "Paramount" : "<b>Paramountᐩ: </b>检测失败,请重试 ❗️",
"Discovery" : "<b>Discoveryᐩ: </b>检测失败,请重试 ❗️", "Discovery" : "<b>Discoveryᐩ: </b>检测失败,请重试 ❗️",
"ChatGPT" : "<b>ChatGPT: </b>检测失败,请重试 ❗️"
//"Google": "Google 定位: 检测失败,请重试" //"Google": "Google 定位: 检测失败,请重试"
} }
@@ -77,7 +82,7 @@ const message = {
testYTB() testYTB()
testDazn() testDazn()
testParam() testParam()
let [{ region, status }] = await Promise.all([testDisneyPlus(),testNf(FILM_ID),testDiscovery()]) let [{ region, status }] = await Promise.all([testDisneyPlus(),testNf(FILM_ID),testDiscovery(),testChatGPT()])
console.log("NetFlix Result:"+result["Netflix"]) console.log("NetFlix Result:"+result["Netflix"])
console.log(`testDisneyPlus: region=${region}, status=${status}`) console.log(`testDisneyPlus: region=${region}, status=${status}`)
if (status==STATUS_COMING) { if (status==STATUS_COMING) {
@@ -94,7 +99,7 @@ const message = {
result["Disney"] = "<b>Disneyᐩ:</b> 检测超时 🚦 " result["Disney"] = "<b>Disneyᐩ:</b> 检测超时 🚦 "
} }
let content = "------------------------------"+"</br>"+([result["YouTube"],result["Netflix"],result["Disney"],result["Dazn"],result["Paramount"],result["Discovery"]]).join("</br></br>") let content = "------------------------------"+"</br>"+([result["YouTube"],result["Netflix"],result["Disney"],result["Dazn"],result["Paramount"],result["Discovery"],result["ChatGPT"]]).join("</br></br>")
content = content + "</br>------------------------------</br>"+"<font color=#CD5C5C >"+"<b>节点</b> ➟ " + $environment.params+ "</font>" content = content + "</br>------------------------------</br>"+"<font color=#CD5C5C >"+"<b>节点</b> ➟ " + $environment.params+ "</font>"
content =`<p style="text-align: center; font-family: -apple-system; font-size: large; font-weight: thin">` + content + `</p>` content =`<p style="text-align: center; font-family: -apple-system; font-size: large; font-weight: thin">` + content + `</p>`
// cnt = `<p style="text-align: center; font-family: -apple-system; font-size: large; font-weight: thin">` +'----------------------</br></br>'+result["Disney"]+'</br></br>----------------------</br>'+$environment.params + `</p>` // cnt = `<p style="text-align: center; font-family: -apple-system; font-size: large; font-weight: thin">` +'----------------------</br></br>'+result["Disney"]+'</br></br>----------------------</br>'+$environment.params + `</p>`
@@ -105,7 +110,7 @@ $configuration.sendMessage(message).then(resolve => {
} }
if (resolve.ret) { if (resolve.ret) {
let output=JSON.stringify(resolve.ret[message.content])? JSON.stringify(resolve.ret[message.content]).replace(/\"|\[|\]/g,"").replace(/\,/g," ➟ ") : $environment.params let output=JSON.stringify(resolve.ret[message.content])? JSON.stringify(resolve.ret[message.content]).replace(/\"|\[|\]/g,"").replace(/\,/g," ➟ ") : $environment.params
let content = "--------------------------------------</br>"+([result["Dazn"],result["Discovery"],result["Paramount"],result["Disney"],result["Netflix"],result["YouTube"]]).join("</br></br>") let content = "--------------------------------------</br>"+([result["Dazn"],result["Discovery"],result["Paramount"],result["Disney"],result["ChatGPT"],result["Netflix"],result["YouTube"]]).join("</br></br>")
content = content + "</br>--------------------------------------</br>"+"<font color=#CD5C5C>"+"<b>节点</b> ➟ " + output+ "</font>" content = content + "</br>--------------------------------------</br>"+"<font color=#CD5C5C>"+"<b>节点</b> ➟ " + output+ "</font>"
content =`<p style="text-align: center; font-family: -apple-system; font-size: large; font-weight: thin">` + content + `</p>` content =`<p style="text-align: center; font-family: -apple-system; font-size: large; font-weight: thin">` + content + `</p>`
//$notify(typeof(output),output) //$notify(typeof(output),output)
@@ -129,7 +134,7 @@ $configuration.sendMessage(message).then(resolve => {
} }
if (resolve.ret) { if (resolve.ret) {
let output=JSON.stringify(resolve.ret[message.content])? JSON.stringify(resolve.ret[message.content]).replace(/\"|\[|\]/g,"").replace(/\,/g," ➟ ") : $environment.params let output=JSON.stringify(resolve.ret[message.content])? JSON.stringify(resolve.ret[message.content]).replace(/\"|\[|\]/g,"").replace(/\,/g," ➟ ") : $environment.params
let content = "--------------------------------------</br>"+([result["Dazn"],result["Discovery"],result["Paramount"],result["Disney"],result["Netflix"],result["YouTube"]]).join("</br></br>") let content = "--------------------------------------</br>"+([result["Dazn"],result["Discovery"],result["Paramount"],result["Disney"],result["ChatGPT"],result["Netflix"],result["YouTube"]]).join("</br></br>")
content = content + "</br>--------------------------------------</br>"+"<font color=#CD5C5C>"+"<b>节点</b> ➟ " + output+ "</font>" content = content + "</br>--------------------------------------</br>"+"<font color=#CD5C5C>"+"<b>节点</b> ➟ " + output+ "</font>"
content =`<p style="text-align: center; font-family: -apple-system; font-size: large; font-weight: thin">` + content + `</p>` content =`<p style="text-align: center; font-family: -apple-system; font-size: large; font-weight: thin">` + content + `</p>`
//$notify(typeof(output),output) //$notify(typeof(output),output)
@@ -497,7 +502,6 @@ function testParam() {
} }
function testDiscovery() { function testDiscovery() {
return new Promise((resolve, reject) =>{ return new Promise((resolve, reject) =>{
let option = { let option = {
@@ -557,3 +561,54 @@ function testDiscovery() {
resolve("discovery failed") resolve("discovery failed")
})})} })})}
// openai test
support_countryCodes=["T1","XX","AL","DZ","AD","AO","AG","AR","AM","AU","AT","AZ","BS","BD","BB","BE","BZ","BJ","BT","BA","BW","BR","BG","BF","CV","CA","CL","CO","KM","CR","HR","CY","DK","DJ","DM","DO","EC","SV","EE","FJ","FI","FR","GA","GM","GE","DE","GH","GR","GD","GT","GN","GW","GY","HT","HN","HU","IS","IN","ID","IQ","IE","IL","IT","JM","JP","JO","KZ","KE","KI","KW","KG","LV","LB","LS","LR","LI","LT","LU","MG","MW","MY","MV","ML","MT","MH","MR","MU","MX","MC","MN","ME","MA","MZ","MM","NA","NR","NP","NL","NZ","NI","NE","NG","MK","NO","OM","PK","PW","PA","PG","PE","PH","PL","PT","QA","RO","RW","KN","LC","VC","WS","SM","ST","SN","RS","SC","SL","SG","SK","SI","SB","ZA","ES","LK","SR","SE","CH","TH","TG","TO","TT","TN","TR","TV","UG","AE","US","UY","VU","ZM","BO","BN","CG","CZ","VA","FM","MD","PS","KR","TW","TZ","TL","GB"]
function testChatGPT() {
return new Promise((resolve, reject) =>{
let option = {
url: BASE_URL_GPT,
opts: opts1,
timeout: 2800,
}
$task.fetch(option).then(response=> {
let resp = JSON.stringify(response)
console.log("ChatGPT Main Test")
let jdg = resp.indexOf("text/plain")
if(jdg == -1) {
let option1 = {
url: Region_URL_GPT,
opts: opts1,
timeout: 2800,
}
$task.fetch(option1).then(response=> {
console.log("ChatGPT Region Test")
let region = response.body.split("loc=")[1].split("\n")[0]
console.log("ChatGPT Region: "+region)
let res = support_countryCodes.indexOf(region)
if (res != -1) {
result["ChatGPT"] = "<b>ChatGPT: </b>支持 "+arrow+ "⟦"+flags.get(region.toUpperCase())+"⟧ 🎉"
console.log("支持 ChatGPT")
resolve("支持 ChatGPT")
return
} else {
result["ChatGPT"] = "<b>ChatGPT: </b>未支持 🚫"
console.log("不支持 ChatGPT")
resolve("不支持 ChatGPT")
return
}
}, reason => {
console.log("Check-Error"+reason)
resolve("ChatGPT failed")
})
} else {
result["ChatGPT"] = "<b>ChatGPT: </b>未支持 🚫"
console.log("不支持 ChatGPT")
resolve("不支持 ChatGPT")
}
}, reason => {
console.log("ChatGPT-Error"+reason)
resolve("ChatGPT failed")
})})}