-
Notifications
You must be signed in to change notification settings - Fork 0
/
netflixCheck.js
103 lines (95 loc) · 2.74 KB
/
netflixCheck.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
//let params = getParams($argument)
const BASE_URL = 'https://www.netflix.com/title/'
const FILM_ID = 81215567
const AREA_TEST_FILM_ID = 80018499
;(async () => {
let result = {
title: "𝗡𝗘𝗧𝗙𝗟𝗜𝗫",
icon: "bolt.slash.circle",
'icon-color':"#801DAE",
content: '请刷新网络后重试',
}
await test(FILM_ID)
.then((code) => {
if (code === 'Not Found') {
return test(AREA_TEST_FILM_ID)
}
result['Title'] ="𝗡𝗘𝗧𝗙𝗟𝗜𝗫"
result['icon'] = "play.circle"
result['icon-color'] = '#00BC12'
//result['icon'] = params.icon1
//result['icon-color'] = params.color1
result['content'] = '已解锁奈飞' + ' ➟ 区域 ' + code.toUpperCase()
return Promise.reject('BreakSignal')
})
.then((code) => {
if (code === 'Not Found') {
return Promise.reject('Not Available')
}
result['Title'] ="𝗡𝗘𝗧𝗙𝗟𝗜𝗫"
result['icon'] = "pause.circle"
result['icon-color'] = "#FFB61E"
//result['icon'] = params.icon2
//result['icon-color'] = params.color2
result['content'] = '仅支持自制剧' + ' ➟ 区域 ' + code.toUpperCase()
return Promise.reject('BreakSignal')
})
.catch((error) => {
if (error === 'Not Available') {
result['Title'] ="𝗡𝗘𝗧𝗙𝗟𝗜𝗫"
result['icon'] = "stop.circle"
result['icon-color'] = "#FF2121"
//result['icon'] = params.icon3
//result['icon-color'] = params.color3
result['content'] = '该节点未解锁奈飞'
return
}
})
.finally(() => {
$done(result)
})
})()
function test(filmId) {
return new Promise((resolve, reject) => {
let option = {
url: BASE_URL + filmId,
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',
},
}
$httpClient.get(option, function (error, response, data) {
if (error != null) {
reject('Error')
return
}
if (response.status === 403) {
reject('Not Available')
return
}
if (response.status === 404) {
resolve('Not Found')
return
}
if (response.status === 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 getParams(param) {
return Object.fromEntries(
$argument
.split("&")
.map((item) => item.split("="))
.map(([k, v]) => [k, decodeURIComponent(v)])
);
}