-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstreaming-ui-check.js
496 lines (452 loc) · 20 KB
/
streaming-ui-check.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
const BASE_URL = 'https://www.netflix.com/title/';
const BASE_URL_YTB = "https://www.youtube.com/premium";
const BASE_URL_DISNEY = 'https://www.disneyplus.com';
const BASE_URL_Dazn = "https://startup.core.indazn.com/misl/v5/Startup";
const BASE_URL_Param = "https://www.paramountplus.com/"
const FILM_ID = 81215567
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 link = { "media-url": "https://raw.githubusercontent.com/KOP-XIAO/QuantumultX/master/img/southpark/7.png" }
const policy_name = "Netflix" //填入你的 netflix 策略組名
const arrow = " ➟ "
const UA = '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'
// 即將登陸
const STATUS_COMING = 2
// 支持解鎖
const STATUS_AVAILABLE = 1
// 不支持解鎖
const STATUS_NOT_AVAILABLE = 0
// 檢測超時
const STATUS_TIMEOUT = -1
// 檢測異常
const STATUS_ERROR = -2
var opts = {
policy: $environment.params
};
var opts1 = {
policy: $environment.params,
redirection: false
};
var flags = new Map([[ "AC" , "🇦🇨" ] ,["AE","🇦🇪"], [ "AF" , "🇦🇫" ] , [ "AI" , "🇦🇮" ] , [ "AL" , "🇦🇱" ] , [ "AM" , "🇦🇲" ] , [ "AQ" , "🇦🇶" ] , [ "AR" , "🇦🇷" ] , [ "AS" , "🇦🇸" ] , [ "AT" , "🇦🇹" ] , [ "AU" , "🇦🇺" ] , [ "AW" , "🇦🇼" ] , [ "AX" , "🇦🇽" ] , [ "AZ" , "🇦🇿" ] , ["BA", "🇧🇦"], [ "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" , "🇿🇦"]])
let result = {
"title": ' 📺 流媒體服務查詢',
"YouTube": '<b>YouTube: </b>檢測失敗,請重試 ❗️',
"Netflix": '<b>Netflix: </b>檢測失敗,請重試 ❗️',
"Dazn": "<b>Dazn: </b>檢測失敗,請重試 ❗️",
"Disney": "<b>Disneyᐩ: </b>檢測失敗,請重試 ❗️",
"Paramount" : "<b>Paramountᐩ: </b>檢測失敗,請重試 ❗️",
"Discovery" : "<b>Discoveryᐩ: </b>檢測失敗,請重試 ❗️",
}
const message = {
action: "get_policy_state",
content: $environment.params
};
;(async () => {
testYTB()
testDazn()
testParam()
let [{ region, status }] = await Promise.all([testDisneyPlus(),testNf(FILM_ID),testDiscovery()])
console.log(result["Netflix"])
console.log(`testDisneyPlus: region=${region}, status=${status}`)
if (status==STATUS_COMING) {
//console.log(1)
result["Disney"] = "<b>Disneyᐩ:</b> ⚠️ 即將登陸 ➟ "+'⟦'+flags.get(region.toUpperCase())+"⟧"
} else if (status==STATUS_AVAILABLE){
//console.log(2)
result["Disney"] = "<b>Disneyᐩ:</b> 支持 ➟ "+'⟦'+flags.get(region.toUpperCase())+"⟧ 🎉"
console.log(result["Disney"])
} else if (status==STATUS_NOT_AVAILABLE) {
//console.log(3)
result["Disney"] = "<b>Disneyᐩ:</b> 未支持 🚫 "
} else if (status==STATUS_TIMEOUT) {
result["Disney"] = "<b>Disneyᐩ:</b> 檢測超時 🚦 "
}
let content = "------------------------------"+"</br>"+([result["YouTube"],result["Netflix"],result["Disney"],result["Dazn"],result["Paramount"],result["Discovery"]]).join("</br></br>")
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>`
// 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>`
$configuration.sendMessage(message).then(resolve => {
if (resolve.error) {
console.log(resolve.error);
$done()
}
if (resolve.ret) {
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>")
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>`
//$notify(typeof(output),output)
console.log(output);
$done({"title":result["title"],"htmlMessage":content})
}
//$done();|
}, reject => {
// Normally will never happen.
$done();
});
//$done({"title":result["title"],"htmlMessage":content})
})()
.finally(() => {
$configuration.sendMessage(message).then(resolve => {
if (resolve.error) {
console.log(resolve.error);
$done()
}
if (resolve.ret) {
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>")
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>`
//$notify(typeof(output),output)
console.log(output);
$done({"title":result["title"],"htmlMessage":content})
}
//$done();|
}, reject => {
// Normally will never happen.
$done();
});
$done({"title":result["title"],"htmlMessage":`<p style="text-align: center; font-family: -apple-system; font-size: large; font-weight: thin">`+'----------------------</br></br>'+"🚥 檢測異常"+'</br></br>----------------------</br>'+ output + `</p>`})
}
);
async function testDisneyPlus() {
try {
let { region, cnbl } = await Promise.race([testHomePage(), timeout(7000)])
console.log(`homepage: region=${region}, cnbl=${cnbl}`)
// 即將登陸
// if (cnbl == 2) {
// return { region, status: STATUS_COMING }
// }
let { countryCode, inSupportedLocation } = await Promise.race([getLocationInfo(), timeout(7000)])
console.log(`getLocationInfo: countryCode=${countryCode}, inSupportedLocation=${inSupportedLocation}`)
region = countryCode ?? region
console.log( "region:"+region)
// 即將登陸
if (inSupportedLocation === false || inSupportedLocation === 'false') {
return { region, status: STATUS_COMING }
} else {
// 支持解鎖
return { region, status: STATUS_AVAILABLE }
}
} catch (error) {
console.log("error:"+error)
// 不支持解鎖
if (error === 'Not Available') {
console.log("不支持")
return { status: STATUS_NOT_AVAILABLE }
}
// 檢測超時
if (error === 'Timeout') {
return { status: STATUS_TIMEOUT }
}
return { status: STATUS_ERROR }
}
}
function getLocationInfo() {
return new Promise((resolve, reject) => {
let opts0 = {
url: 'https://disney.api.edge.bamgrid.com/graph/v1/device/graphql',
method: "POST",
opts: opts,
headers: {
'Accept-Language': 'en',
"Authorization": 'ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84',
'Content-Type': 'application/json',
'User-Agent': UA,
},
body: JSON.stringify({
query: 'mutation registerDevice($input: RegisterDeviceInput!) { registerDevice(registerDevice: $input) { grant { grantType assertion } } }',
variables: {
input: {
applicationRuntime: 'chrome',
attributes: {
browserName: 'chrome',
browserVersion: '94.0.4606',
manufacturer: 'microsoft',
model: null,
operatingSystem: 'windows',
operatingSystemVersion: '10.0',
osDeviceIds: [],
},
deviceFamily: 'browser',
deviceLanguage: 'en',
deviceProfile: 'windows',
},
},
}),
}
$task.fetch(opts0).then(response => {
let data = response.body
console.log("locationinfo:"+response.statusCode)
if (response.statusCode !== 200) {
console.log('getLocationInfo: ' + data)
reject('Not Available')
return
} else {let {
inSupportedLocation,
location: { countryCode },
} = JSON.parse(data)?.extensions?.sdk?.session
resolve({ inSupportedLocation, countryCode })
}
}, reason => {
reject('Error')
return
})
})
}
function testHomePage() {
return new Promise((resolve, reject) => {
let opts0 = {
url: 'https://www.disneyplus.com/',
opts: opts,
headers: {
'Accept-Language': 'en',
'User-Agent': UA,
},
}
$task.fetch(opts0).then(response => {
let data = response.body
console.log("homepage"+response.statusCode)
if (response.statusCode !== 200 || data.indexOf('unavailable') !== -1) {
reject('Not Available')
return
} else {
let match = data.match(/Region: ([A-Za-z]{2})[\s\S]*?CNBL: ([12])/)
if (!match) {
resolve({ region: '', cnbl: '' })
return
} else {
let region = match[1]
let cnbl = match[2]
//console.log("homepage"+region+cnbl)
resolve({ region, cnbl })
}
}
}, reason => {
reject('Error')
return
})
})
}
function timeout(delay = 5000) {
return new Promise((resolve, reject) => {
setTimeout(() => {
reject('Timeout')
}, delay)
})
}
function testNf(filmId) {
return new Promise((resolve, reject) =>{
let option = {
url: BASE_URL + filmId,
opts: opts,
timeout: 3200,
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 => {
//$notify("nf:"+response.statusCode)
console.log("nf:"+response.statusCode)
if (response.statusCode === 404) {
result["Netflix"] = "<b>Netflix: </b>支持自制劇集 ⚠️"
console.log("nf:"+result["Netflix"])
resolve('Not Found')
return
} else if (response.statusCode === 403) {
//console.log("nfnf")
result["Netflix"] = "<b>Netflix: </b>未支持 🚫"
console.log("nf:"+result["Netflix"])
//$notify("nf:"+result["Netflix"])
resolve('Not Available')
return
} else 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'
}
console.log("nf:"+region)
result["Netflix"] = "<b>Netflix: </b>完整支持"+arrow+ "⟦"+flags.get(region.toUpperCase())+"⟧ 🎉"
//$notify("nf:"+result["Netflix"])
resolve("nf:"+result["Netflix"])
return
}
}, reason => {
result["Netflix"] = "<b>Netflix: </b>檢測超時 🚦"
console.log(result["Netflix"])
resolve("timeout")
}
)
}
)
}
function testYTB() {
let option = {
url: BASE_URL_YTB,
opts: opts,
timeout: 2800,
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("ytb:"+response.statusCode)
if (response.statusCode !== 200) {
//reject('Error')
result["YouTube"] = "<b>YouTube Premium: </b>檢測失敗 ❗️"
} else if (data.indexOf('Premium is not available in your country') !== -1) {
//resolve('Not Available')
result["YouTube"] = "<b>YouTube Premium: </b>未支持 🚫"
} else if (data.indexOf('Premium is not available in your country') == -1) {//console.log(data.split("countryCode")[1])
let region = ''
let re = new RegExp('"GL":"(.*?)"', 'gm')
let ret = re.exec(data)
if (ret != null && ret.length === 2) {
region = ret[1]
} else if (data.indexOf('www.google.cn') !== -1) {
region = 'CN'
} else {
region = 'US'
}
//resolve(region)
result["YouTube"] = "<b>YouTube Premium: </b>支持 "+arrow+ "⟦"+flags.get(region.toUpperCase())+"⟧ 🎉"
console.log("ytb:"+region+ result["YouTube"])
}
}, reason => {
result["YouTube"] = "<b>YouTube Premium: </b>檢測超時 🚦"
//resolve("timeout")
})
}
function testDazn() {
const extra =`{
"LandingPageKey":"generic",
"Platform":"web",
"PlatformAttributes":{},
"Manufacturer":"",
"PromoCode":"",
"Version":"2"
}`
let option = {
url: BASE_URL_Dazn,
method: "POST",
opts: opts,
timeout: 2800,
headers: {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36',
"Content-Type": "application/json"
},
body: extra
}
$task.fetch(option).then(response=> {
let data = response.body
//data = extra
let header = JSON.stringify(response.headers)
console.log("Dazn:"+response.statusCode)
//console.log("Dazn:"+data)
//$done(data)
if (response.statusCode !== 200) {
//reject('Error')
result["Dazn"] = "<b>Dazn: </b>檢測失敗 ❗️"
} else if (response.statusCode == 200) {//console.log(data.split("countryCode")[1])
//console.log(data)
let region = ''
let re = new RegExp('"GeolocatedCountry":"(.*?)"', 'gm')
let ret = re.exec(data)
if (ret != null && ret.length === 2) {
region = ret[1]
result["Dazn"] = "<b>Dazn: </b>支持 "+arrow+ "⟦"+flags.get(region.toUpperCase())+"⟧ 🎉"
} else {
result["Dazn"] = "<b>Dazn: </b>未支持 🚫"
}
//resolve(region)
console.log("Dazn:"+region+ result["Dazn"])
}
}, reason => {
result["Dazn"] = "<b>Dazn: </b>檢測超時 🚦"
//resolve("timeout")
})
}
function testParam() {
let option = {
url: BASE_URL_Param,
opts: opts1,
timeout: 2800,
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("Paramountᐩ:"+response.statusCode)
if (response.statusCode == 200) {
//reject('Error')
result["Paramount"] = "<b>Paramountᐩ: </b>支持 🎉 "
} else if (response.statusCode == 302) {
//resolve('Not Available')
result["Paramount"] = "<b>Paramountᐩ: </b>未支持 🚫"
}
console.log("Paramountᐩ:"+ result["Paramount"])
}, reason => {
result["Paramount"] = "<b>Paramountᐩ: </b>檢測超時 🚦"
//resolve("timeout")
})
}
function testDiscovery() {
return new Promise((resolve, reject) =>{
let option = {
url: BASE_URL_Discovery_token,
opts: opts1,
timeout: 2800,
headers: {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36'
},
verify: false
}
$task.fetch(option).then(response=> {
console.log("GetToken:"+response.statusCode)
let data = JSON.parse(response.body)
let token = data["data"]["attributes"]["token"]
const cookievalid =`_gcl_au=1.1.858579665.1632206782; _rdt_uuid=1632206782474.6a9ad4f2-8ef7-4a49-9d60-e071bce45e88; _scid=d154b864-8b7e-4f46-90e0-8b56cff67d05; _pin_unauth=dWlkPU1qWTRNR1ZoTlRBdE1tSXdNaTAwTW1Nd0xUbGxORFV0WWpZMU0yVXdPV1l6WldFeQ; _sctr=1|1632153600000; aam_fw=aam%3D9354365%3Baam%3D9040990; aam_uuid=24382050115125439381416006538140778858; st=${token}; gi_ls=0; _uetvid=a25161a01aa711ec92d47775379d5e4d; AMCV_BC501253513148ED0A490D45%40AdobeOrg=-1124106680%7CMCIDTS%7C18894%7CMCMID%7C24223296309793747161435877577673078228%7CMCAAMLH-1633011393%7C9%7CMCAAMB-1633011393%7CRKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y%7CMCOPTOUT-1632413793s%7CNONE%7CvVersion%7C5.2.0; ass=19ef15da-95d6-4b1d-8fa2-e9e099c9cc38.1632408400.1632406594`
let option1 = {
url: BASE_URL_Discovery,
opts: opts1,
timeout: 2800,
headers: {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36',
"Cookie": cookievalid,
},
ciphers: "DEFAULT@SECLEVEL=1",
verify: false
}
$task.fetch(option1).then(response=> {
console.log("Check:"+response.statusCode)
let data = JSON.parse(response.body)
let locationd = data["data"]["attributes"]["currentLocationTerritory"]
if (locationd == "us") {
result["Discovery"] = "<b>Discoveryᐩ: </b>支持 🎉 "
console.log("支持Discoveryᐩ")
resolve("支持Discoveryᐩ")
return
} else {
result["Discovery"] = "<b>Discoveryᐩ: </b>未支持 🚫"
console.log("不支持Discoveryᐩ")
resolve("不支持Discoveryᐩ")
return
}
}, reason => {
console.log("Check-Error"+reason)
resolve("discovery failed")
})
}, reason => {
console.log("GetToken-Error"+reason)
resolve("discovery failed")
})})}