diff options
author | sjlleo <[email protected]> | 2021-02-25 10:55:41 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-25 10:55:41 +0800 |
commit | cb16b7a540bff5b82cf202b84c97d506280c14a9 (patch) | |
tree | 82e9649d62fb1eea67d7ff6e211581f76bbd87ac | |
parent | 3a430bbd4274d302233cfa75aff00045ab6ff0a3 (diff) |
改善地区判断的逻辑
-rw-r--r-- | nf.go | 38 |
1 files changed, 27 insertions, 11 deletions
@@ -15,7 +15,8 @@ const Netflix = "https://www.netflix.com/title/" func VerifyAreaAvailable() { status := GetResponse(80018499) fmt.Println("** NetFlix 解锁检测小工具 By \033[1;36m@sjlleo\033[0m **") - if status == -1{ + fmt.Println("\033[0;33m友情提示:本脚本不支持双栈检测\033[0m") + if status == -1 { fmt.Println("\033[0;33mNetFlix不在您测试的出口IP所在的地区提供服务,无法正常使用NF网站\033[0m") } else if status == -2 { fmt.Println("\033[0;33m网络异常,连接NetFlix失败,请检查后重试\033[0m") @@ -40,27 +41,42 @@ func VerifySelfMade() bool { // VerifyNonSelfMade - Check NonSelf-Made Movie func VerifyNonSelfMade() { fmt.Println("->> 正在检查支持的NetFlix地区 <<-") - MovieSpecialID := [32]int{70143836, 80057401, 70215460, 81324707, 81370688, 81269607, 81307998, 81327393, 81052553, 81299764, 81029396, 81240443, 81297517, 70241077, 81043527, 81232435, 81396420, 81351679, 60036229, 81290755, 81016002, 81382683, 80227207, 70295176, 81186099, 70271605, 81288438, 81323786, 81347799, 70108563, 81191900, 60020039} - MovieCountry := [32]string{"通用地", "新加坡", "香港", "南非", "日本", "美国", "泰国", "俄罗斯", "德国", "韩国", "比利时", "冰岛", "印度", "英国", "土耳其", "罗马尼亚", "波兰", "瑞典", "立陶宛", "法国", "阿根廷", "澳大利亚", "加拿大", "台湾/马来西亚", "荷兰", "西班牙", "匈牙利", "以色列", "巴西", "捷克共和国", "斯洛伐克", "希腊"} - MainLanguage := [32]string{"无","中文简体、繁体","中文简体、繁体","英语","日语","英语","泰语、英文","俄语","德语、英语","韩语","荷兰语、英语","英语","北印度语","英语","土耳其语","罗马尼亚语、西班牙语、英语","波兰语、英语","瑞典语、丹麦语","英语","法语、英语","西班牙语","英语","英语、法语","英语、粤语、中文简体、中文繁体","荷兰语","西班牙语","匈牙利语","阿拉伯语","葡萄牙语、西班牙语","捷克语","捷克语","希腊语"} - if GetResponse(MovieSpecialID[0]) != 1 { + MovieSpecialID := [37]string{"sg", "hk", "za", "jp", "index", "th", "ru", "de", "kr", "be", "is", "in", "uk", "tr", "ro", "pl", "se", "lt", "fr", "ar", "au", "ca", "my", "tw", "nl", "es", "hu", "il", "br", "cz", "sk", "gr", "ph", "ch", "fi", "ci", "it"} + MovieCountry := [37]string{"新加坡", "香港", "南非", "日本", "美国", "泰国", "俄罗斯", "德国", "韩国", "比利时", "冰岛", "印度", "英国", "土耳其", "罗马尼亚", "波兰", "瑞典", "立陶宛", "法国", "阿根廷", "澳大利亚", "加拿大", "马来西亚", "台湾", "荷兰", "西班牙", "匈牙利", "以色列", "巴西", "捷克共和国", "斯洛伐克", "希腊", "菲律宾", "瑞士", "芬兰", "智利", "意大利"} + MainLanguage := [37]string{"中文简体、繁体", "中文简体、繁体", "英语", "日语", "英语", "泰语、英文", "俄语", "德语、英语", "韩语", "荷兰语、英语", "英语", "北印度语", "英语", "土耳其语", "罗马尼亚语、西班牙语、英语", "波兰语、英语", "瑞典语、丹麦语", "英语", "法语、英语", "西班牙语", "英语", "英语、法语", "英语、粤语、中文简体", "中文繁体、中文简体", "荷兰语", "西班牙语", "匈牙利语", "阿拉伯语", "葡萄牙语、西班牙语", "捷克语", "捷克语", "希腊语", "英语", "德语、法语、英语", "芬兰语、英语", "英语", "意大利语、英语"} + + if GetResponse(70143836) != 1 { fmt.Println("\033[0;31m不支持解锁非自制剧\033[0m") return } fmt.Println("\033[0;32m支持解锁全地区通用的非自制剧,正在检测地区...\033[0m") - for i := 1; i < 32; i++ { - if GetResponse(MovieSpecialID[i]) == 1 { - fmt.Println("\033[0;36m原生IP地域解锁信息:\033[1;36m" + MovieCountry[i] + "区 NetFlix\033[0m") - fmt.Println("\033[0;36m此地区NF的音轨/字幕主要是:\033[1;36m" + MainLanguage[i] + "\033[0m") - return + countryCode := GetCountryCode() + resIndex := -1 + for i, value := range MovieSpecialID { + if strings.Contains(countryCode, value) { + resIndex = i } } + if resIndex != -1 { + fmt.Println("\033[0;36m原生IP地域解锁信息:\033[1;36m" + MovieCountry[resIndex] + "区 NetFlix\033[0m") + fmt.Println("\033[0;36m此地区NF的音轨/字幕主要是:\033[1;36m" + MainLanguage[resIndex] + "\033[0m") + } else { + fmt.Println("\033[0;36m原生IP地域解锁信息:\033[1;36m" + countryCode + "区 NetFlix\033[0m") + } +} - fmt.Println("\033[1;32m支持解锁全地区通用的非自制剧,但是不能解锁个性化地区的NetFlix\033[0m") +func GetCountryCode() string { + resp, err := http.Get(Netflix + strconv.Itoa(70143836)) + if err != nil { + fmt.Println(err) + } + defer resp.Body.Close() + headers := resp.Header + return strings.Split(headers["X-Originating-Url"][0], "/")[3] } // GetResponse - Verify |