From bcaafa67a3effa56faa49238f8acb4b0e6daac79 Mon Sep 17 00:00:00 2001 From: wonfen Date: Sun, 16 Mar 2025 12:15:35 +0800 Subject: [PATCH] feat: unlock test page --- scripts/check.sh | 5988 +++++++++++++++++++++ src-tauri/Cargo.lock | 53 + src-tauri/Cargo.toml | 3 +- src-tauri/src/cmd/media_unlock_checker.rs | 1204 +++++ src-tauri/src/cmd/mod.rs | 2 + src-tauri/src/lib.rs | 3 + src/components/center.tsx | 21 + src/locales/en.json | 12 +- src/locales/zh.json | 12 +- src/pages/_routers.tsx | 8 + src/pages/unlock.tsx | 395 ++ 11 files changed, 7698 insertions(+), 3 deletions(-) create mode 100644 scripts/check.sh create mode 100644 src-tauri/src/cmd/media_unlock_checker.rs create mode 100644 src/components/center.tsx create mode 100644 src/pages/unlock.tsx diff --git a/scripts/check.sh b/scripts/check.sh new file mode 100644 index 00000000..331457bf --- /dev/null +++ b/scripts/check.sh @@ -0,0 +1,5988 @@ +#!/bin/bash + +VER='1.0.0' + +UA_BROWSER="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36" +UA_SEC_CH_UA='"Google Chrome";v="125", "Chromium";v="125", "Not.A/Brand";v="24"' +UA_ANDROID="Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36" + +color_print() { + Font_Black="\033[30m" + Font_Red="\033[31m" + Font_Green="\033[32m" + Font_Yellow="\033[33m" + Font_Blue="\033[34m" + Font_Purple="\033[35m" + Font_SkyBlue="\033[36m" + Font_White="\033[37m" + Font_Suffix="\033[0m" +} + +command_exists() { + command -v "$1" > /dev/null 2>&1 +} + +gen_uuid() { + if [ -f /proc/sys/kernel/random/uuid ]; then + local genuuid=$(cat /proc/sys/kernel/random/uuid) + echo "${genuuid}" + return 0 + fi + + if command_exists uuidgen; then + local genuuid=$(uuidgen) + echo "${genuuid}" + return 0 + fi + + if command_exists powershell && [ "$OS_WINDOWS" == 1 ]; then + local genuuid=$(powershell -c "[guid]::NewGuid().ToString()") + echo "${genuuid}" + return 0 + fi + + return 1 +} + +gen_random_str() { + if [ -z "$1" ]; then + echo -e "${Font_Red}Length missing.${Font_Suffix}" + exit 1 + fi + local randomstr=$(< /dev/urandom tr -dc A-Za-z0-9 | head -c "$1") + echo "${randomstr}" +} + +resolve_ip_address() { + if [ -z "$1" ]; then + echo -e "${Font_Red}Domain missing.${Font_Suffix}" + exit 1 + fi + if [ -z "$2" ]; then + echo -e "${Font_Red}DNS Record type missing.${Font_Suffix}" + exit 1 + fi + + local domain="$1" + local recordType="$2" + + if command_exists nslookup && [ "$OS_WINDOWS" != 1 ]; then + local nslookupExists=1 + fi + if command_exists dig; then + local digExists=1 + fi + if [ "$OS_IOS" == 1 ]; then + local nslookupExists=0 + local digExists=0 + fi + + if [ "$nslookupExists" == 1 ]; then + if [ "$recordType" == 'AAAA' ]; then + local result=$(nslookup -q=AAAA "${domain}" | grep -woP "Address: \K[\d:a-f]+") + echo "${result}" + return + else + local result=$(nslookup -q=A "${domain}" | grep -woP "Address: \K[\d.]+") + echo "${result}" + return + fi + fi + if [ "$digExists" == 1 ]; then + if [ "$recordType" == 'AAAA' ]; then + local result=$(dig +short "${domain}" AAAA) + echo "${result}" + return + else + local result=$(dig +short "${domain}" A) + echo "${result}" + return + fi + fi + + if [ "$recordType" == 'AAAA' ]; then + local pingArgs='-6 -c 1 -w 1 -W 1' + [ "$OS_ANDROID" == 1 ] && pingArgs='-c 1 -w 1 -W 1' + local result=$(ping6 ${pingArgs} "${domain}" 2>/dev/null | head -n 1 | grep -woP '\s\(\K[\d:a-f]+') + echo "${result}" + return + else + local pingArgs='-4 -c 1 -w 1 -W 1' + [ "$OS_ANDROID" == 1 ] && pingArgs='-c 1 -w 1 -W 1' + local result=$(ping ${pingArgs} "${domain}" 2>/dev/null | head -n 1 | grep -woP '\s\(\K[\d.]+') + echo "${result}" + return + fi +} + +validate_proxy() { + if [ -z "$1" ]; then + echo -e "${Font_Red}Param Proxy Address is missing.${Font_Suffix}" + exit 1 + fi + + local tmpresult=$(echo "$1" | grep -P '^(socks|socks4|socks5|http)://([^:]+:[^@]+@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|(\[[0-9a-fA-F:]+\]|([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|((([0-9a-fA-F]{1,4}:){1,6})|::(([0-9a-fA-F]{1,4}:){1,6}))([0-9a-fA-F]{1,4}))):(0|[1-9][0-9]{0,4})$') + if [ -z "$tmpresult" ]; then + echo -e "${Font_Red}Proxy IP invalid.${Font_Suffix}" + exit 1 + fi + + local port=$(echo "$1" | grep -woP ':\K[0-9]+$') + if [ "$port" -ge 65535 ]; then + echo -e "${Font_Red}Proxy Port invalid.${Font_Suffix}" + exit 1 + fi +} + +validate_ip_address() { + if [ -z "$1" ]; then + echo -e "${Font_Red}Param IP Address is missing.${Font_Suffix}" + exit 1 + fi + + if echo "$1" | awk '{$1=$1; print}' | grep -Eq '^([0-9]{1,3}\.){3}[0-9]{1,3}$'; then + return 4 + fi + echo "$1" | awk '{$1=$1; print}' | grep -Eq '^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$|^(([0-9a-fA-F]{1,4}:){1,7}|:):([0-9a-fA-F]{1,4}:){1,7}|:$|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}$|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}$|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}$|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}$|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}$|([0-9a-fA-F]{1,4}:){1}(:[0-9a-fA-F]{1,4}){1,6}$|:(:[0-9a-fA-F]{1,4}){1,7}$|((([0-9a-fA-F]{1,4}:){1,4}:|:):(([0-9a-fA-F]{1,4}:){0,1}[0-9a-fA-F]{1,4}){1,4})$' + if [ "$?" == 0 ]; then + return 6 + fi + + return 1 +} + +validate_intranet() { + if [ -z "$1" ]; then + echo -e "${Font_Red}Param missing.${Font_Suffix}" + fi + # See https://en.wikipedia.org/wiki/Reserved_IP_addresses + local tmpresult=$(echo "$1" | grep -E '(^|\s)(10\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|172\.(1[6-9]|2[0-9]|3[01])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|192\.168\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|100\.([6-9][4-9]|1[0-2][0-7])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|169\.254\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|192\.88\.99\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|192\.0\.(0|2)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|198\.(1[89])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|198\.51\.100\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|203\.0\.113\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|2[23][4-9]\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|233\.252\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|(24[0-9]|25[0-5])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9]))(\s|$)') + if [ -z "$tmpresult" ]; then + return 1 + fi + + return 0 +} + +validate_region_id() { + if [ -z "$1" ]; then + echo -e "${Font_Red}Param missing.${Font_Suffix}" + exit 1 + fi + local regionid="$1" + local result=$(echo "$regionid" | grep -E '^[0-9]$|^1[0-1]$|^99$|^88$|^66$') + if [ -z "$result" ]; then + return 1 + fi + return 0 +} + +validate_net_type() { + if [ -z "$1" ]; then + echo -e "${Font_Red}Param missing.${Font_Suffix}" + exit 1 + fi + local netType="$1" + local result=$(echo "$netType" | grep -E '^4$|^6$|^0$') + if [ -z "$result" ]; then + echo -e "${Font_Red}Invalid Network Type.${Font_Suffix}" + exit 1 + fi + return 0 +} + +check_proxy_connectivity() { + local result1=$(curl $USE_NIC $USE_PROXY -s 'https://ip.sb' --user-agent "${UA_BROWSER}" ) + local result2=$(curl $USE_NIC $USE_PROXY -s 'https://1.0.0.1/cdn-cgi/trace' --user-agent "${UA_BROWSER}") + if [ -n "$result1" ] && [ -n "$result2" ]; then + return 0 + fi + + return 1 +} + +check_net_connctivity() { + if [ -z "$1" ]; then + echo -e "${Font_Red}Param missing.${Font_Suffix}" + exit 1 + fi + + if [ "$1" == 4 ]; then + local result1=$(curl -4 ${CURL_OPTS} -fs 'http://www.msftconnecttest.com/connecttest.txt' -w '%{http_code}' -o /dev/null --user-agent "${UA_BROWSER}") + if [ "$result1" == '200' ]; then + return 0 + fi + fi + + if [ "$1" == 6 ]; then + local result2=$(curl -6 ${CURL_OPTS} -fs 'http://ipv6.msftconnecttest.com/connecttest.txt' -w '%{http_code}' -o /dev/null --user-agent "${UA_BROWSER}") + if [ "$result2" == '200' ]; then + return 0 + fi + fi + + return 1 +} + +check_os_type() { + OS_TYPE='' + local ifLinux=$(uname -a | grep -i 'linux') + local ifFreeBSD=$(uname -a | grep -i 'freebsd') + local ifTermux=$(echo "$PWD" | grep -i 'termux') + local ifMacOS=$(uname -a | grep -i 'Darwin') + local ifMinGW=$(uname -a | grep -i 'MINGW') + local ifCygwin=$(uname -a | grep -i 'CYGWIN') + local ifAndroid=$(uname -a | grep -i 'android') + local ifiSh=$(uname -a | grep -i '\-ish') + + if [ -n "$ifLinux" ] && [ -z "$ifAndroid" ] && [ -z "$ifiSh" ]; then + OS_TYPE='linux' + OS_LINUX=1 + return + fi + if [ -n "$ifTermux" ]; then + OS_TYPE='termux' + OS_TERMUX=1 + OS_ANDROID=1 + return + fi + if [ -n "$ifMacOS" ]; then + OS_TYPE='macos' + OS_MACOS=1 + return + fi + if [ -n "$ifMinGW" ]; then + OS_TYPE='msys' + OS_WINDOWS=1 + return + fi + if [ -n "$ifCygwin" ]; then + OS_TYPE='cygwin' + OS_WINDOWS=1 + return + fi + if [ -n "$ifFreeBSD" ]; then + OS_TYPE='freebsd' + OS_FREEBSD=1 + return + fi + if [ -n "$ifAndroid" ]; then + OS_TYPE='android' + OS_ANDROID=1 + return + fi + if [ -n "$ifiSh" ]; then + OS_TYPE='ish' + OS_IOS=1 + return + fi + + echo -e "${Font_Red}Unsupported OS Type.${Font_Suffix}" + exit 1 +} + +check_dependencies() { + CURL_SSL_CIPHERS_OPT='' + + if [ "$OS_TYPE" == 'linux' ]; then + source /etc/os-release + if [ -z "$ID" ]; then + echo -e "${Font_Red}Unsupported Linux OS Type.${Font_Suffix}" + exit 1 + fi + + case "$ID" in + debian|devuan|kali) + OS_NAME='debian' + PKGMGR='apt' + ;; + ubuntu) + OS_NAME='ubuntu' + PKGMGR='apt' + ;; + centos|fedora|rhel|almalinux|rocky|amzn) + OS_NAME='rhel' + PKGMGR='dnf' + ;; + arch|archarm) + OS_NAME='arch' + PKGMGR='pacman' + ;; + alpine) + OS_NAME='alpine' + PKGMGR='apk' + ;; + *) + OS_NAME="$ID" + PKGMGR='apt' + ;; + esac + fi + + if [ -z $(echo 'e' | grep -P 'e' 2>/dev/null) ]; then + echo -e "${Font_Red}command 'grep' function is incomplete, please install the full version first.${Font_Suffix}" + exit 1 + fi + + if ! command_exists curl; then + echo -e "${Font_Red}command 'curl' is missing, please install it first.${Font_Suffix}" + exit 1 + fi + + if ! gen_uuid >/dev/null; then + echo -e "${Font_Red}command 'uuidgen' is missing, please install it first.${Font_Suffix}" + exit 1 + fi + + if ! command_exists openssl; then + echo -e "${Font_Red}command 'openssl' is missing, please install it first.${Font_Suffix}" + exit 1 + fi + + if [ "$OS_MACOS" == 1 ]; then + if ! command_exists md5sum; then + echo -e "${Font_Red}command 'md5sum' is missing, please install it first.${Font_Suffix}" + exit 1 + fi + if ! command_exists sha256sum; then + echo -e "${Font_Red}command 'sha256sum' is missing, please install it first.${Font_Suffix}" + exit 1 + fi + fi + + if [ "$OS_NAME" == 'debian' ] || [ "$OS_NAME" == 'ubuntu' ]; then + local os_version=$(echo "$VERSION_ID" | tr -d '.') + if [ "$os_version" == "2004" ] || [ "$os_version" == "10" ] || [ "$os_version" == "11" ]; then + CURL_SSL_CIPHERS_OPT='-k --ciphers DEFAULT@SECLEVEL=1' + fi + fi + + if command_exists usleep; then + USE_USLEEP=1 + fi +} + +process() { + local iface='' + local xip='' + local proxy='' + USE_NIC='' + NETWORK_TYPE='' + LANGUAGE='' + X_FORWARD='' + USE_PROXY='' + + while [ $# -gt 0 ]; do + case "$1" in + -I | --interface) + local iface="$2" + USE_NIC="--interface $2" + shift + ;; + -M | --network-type) + local netType="$2" + shift + ;; + -E | --language) + LANGUAGE="$2" + shift + ;; + -X | --x-forwarded-for) + local xip="$2" + shift + ;; + -P | --proxy) + local proxy="$2" + shift + ;; + -R | --region) + local regionid="$2" + shift + ;; + *) + echo -e "${Font_Red}Unknown error while processing options.${Font_Suffix}" + exit 1 + ;; + esac + shift + done + + if [ -z "$iface" ]; then + USE_NIC='' + fi + + if [ -z "$xip" ]; then + X_FORWARD='' + fi + + if [ -n "$xip" ]; then + local xip=$(echo "$xip" | awk '{$1=$1; print}') + validate_ip_address "$xip" + local result="$?" + if [ "$result" == 4 ] || [ "$result" == 6 ]; then + X_FORWARD="--header X-Forwarded-For:$xip" + fi + fi + + if [ -z "$proxy" ]; then + USE_PROXY='' + fi + + if [ -n "$proxy" ]; then + local proxy=$(echo "$proxy" | awk '{$1=$1; print}') + if validate_proxy "$proxy"; then + USE_PROXY="-x $proxy" + fi + fi + + if [ -z "$netType" ]; then + NETWORK_TYPE='' + fi + + if [ -n "$netType" ]; then + local netType=$(echo "$netType" | awk '{$1=$1; print}') + if validate_net_type "$netType"; then + NETWORK_TYPE="$netType" + fi + fi + + if [ -z "$LANGUAGE" ]; then + LANGUAGE='zh' + fi + + if [ -n "$regionid" ]; then + if validate_region_id "$regionid"; then + REGION_ID="$regionid" + fi + fi + + CURL_OPTS="$USE_NIC $USE_PROXY $X_FORWARD ${CURL_SSL_CIPHERS_OPT} --max-time 10 --retry 3 --retry-max-time 20" +} + +delay() { + if [ -z $1 ]; then + exit 1 + fi + local val=$1 + if [ "$USE_USLEEP" == 1 ]; then + usleep $(awk 'BEGIN{print '$val' * 1000000}') + return 0 + fi + sleep $val + return 0 +} + +count_run_times() { + local tmpresult=$(curl ${CURL_OPTS} -s "https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fcheck.unclock.media&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=visit&edge_flat=false") + TODAY_RUN_TIMES=$(echo "$tmpresult" | tail -3 | head -n 1 | awk '{print $5}') + TOTAL_RUN_TIMES=$(($(echo "$tmpresult" | tail -3 | head -n 1 | awk '{print $7}') + 2527395)) +} + +download_extra_data() { + MEDIA_COOKIE=$(curl ${CURL_OPTS} -s "https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/cookies") + IATACODE=$(curl ${CURL_OPTS} -s "https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/reference/IATACode.txt") + IATACODE2=$(curl ${CURL_OPTS} -s "https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/reference/IATACode2.txt") + if [ -z "$MEDIA_COOKIE" ] || [ -z "$IATACODE" ] || [ -z "$IATACODE2" ]; then + echo -e "${Font_Red}Extra data download failed.${Font_Suffix}" + delay 3 + fi +} + +get_ip_info() { + LOCAL_IP_ASTERISK='' + LOCAL_ISP='' + local local_ip=$(curl ${CURL_DEFAULT_OPTS} -s https://api64.ipify.org --user-agent "${UA_BROWSER}") + local get_local_isp=$(curl ${CURL_DEFAULT_OPTS} -s "https://api.ip.sb/geoip/${local_ip}" -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + + if [ -z "$local_ip" ]; then + echo -e "${Font_Red}Failed to Query IP Address.${Font_Suffix}" + fi + if [ -z "$get_local_isp" ]; then + echo -e "${Font_Red}Failed to Query IP Info.${Font_Suffix}" + fi + + validate_ip_address "$local_ip" + local resp="$?" + if [ "$resp" == 4 ]; then + LOCAL_IP_ASTERISK=$(awk -F"." '{print $1"."$2".*.*"}' <<<"${local_ip}") + fi + if [ "$resp" == 6 ]; then + LOCAL_IP_ASTERISK=$(awk -F":" '{print $1":"$2":"$3":*:*"}' <<<"${local_ip}") + fi + + LOCAL_ISP=$(echo "$get_local_isp" | grep 'organization' | cut -f4 -d '"') +} + +show_region() { + echo -e "${Font_Yellow} ---${1}---${Font_Suffix}" +} + +function GameTest_Steam() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Steam Currency:\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://store.steampowered.com/app/761830' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Steam Currency:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep 'priceCurrency' | cut -d '"' -f4) + if [ -z "$result" ]; then + echo -n -e "\r Steam Currency:\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + echo -n -e "\r Steam Currency:\t\t\t${Font_Green}${result}${Font_Suffix}\n" +} + +# 流媒体解锁测试-动画疯 +function MediaUnlockTest_BahamutAnime() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Bahamut Anime:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://ani.gamer.com.tw/ajax/getdeviceid.php' --cookie-jar bahamut_cookie.txt --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Bahamut Anime:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + rm -f bahamut_cookie.txt + return + fi + + local tempdeviceid=$(echo "$tmpresult" | grep -woP '"deviceid"\s{0,}:\s{0,}"\K[^"]+') + # I Was Reincarnated as the 7th Prince + local sn='37783' + local tmpresult1=$(curl ${CURL_DEFAULT_OPTS} -sL "https://ani.gamer.com.tw/ajax/token.php?adID=89422&sn=${sn}&device=${tempdeviceid}" -b bahamut_cookie.txt --user-agent "${UA_BROWSER}") + local tmpresult2=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://ani.gamer.com.tw/' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: zh-CN,zh;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-model: ""' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-ch-ua-platform-version: "15.0.0"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -b bahamut_cookie.txt --user-agent "${UA_BROWSER}") + rm -f bahamut_cookie.txt + if [ -z "$tmpresult1" ] || [ -z "$tmpresult2" ]; then + echo -n -e "\r Bahamut Anime:\t\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult1" | grep 'animeSn') + + if [ -z "$result" ]; then + echo -n -e "\r Bahamut Anime:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + local region=$(echo "$tmpresult2" | grep -woP 'data-geo="\K[^"]+') + if [ -n "$region" ]; then + echo -n -e "\r Bahamut Anime:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r Bahamut Anime:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +# 流媒体解锁测试-哔哩哔哩大陆限定 +function MediaUnlockTest_BilibiliChinaMainland() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r BiliBili China Mainland Only:\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local randsession=$(gen_uuid | md5sum | head -c 32) + # 尝试获取成功的结果 + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL "https://api.bilibili.com/pgc/player/web/playurl?avid=82846771&qn=0&type=&otype=json&ep_id=307247&fourk=1&fnver=0&fnval=16&session=${randsession}&module=bangumi" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r BiliBili China Mainland Only:\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}\K[-\d]+' | head -n 1) + case "$result" in + '0') echo -n -e "\r BiliBili China Mainland Only:\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '-10403') echo -n -e "\r BiliBili China Mainland Only:\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r BiliBili China Mainland Only:\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +# 流媒体解锁测试-哔哩哔哩港澳台限定 +function MediaUnlockTest_BilibiliHKMCTW() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r BiliBili Hongkong/Macau/Taiwan:\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local randsession=$(gen_uuid | md5sum | head -c 32) + # 尝试获取成功的结果 + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL "https://api.bilibili.com/pgc/player/web/playurl?avid=18281381&cid=29892777&qn=0&type=&otype=json&ep_id=183799&fourk=1&fnver=0&fnval=16&session=${randsession}&module=bangumi" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r BiliBili Hongkong/Macau/Taiwan:\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}\K[-\d]+' | head -n 1) + case "$result" in + '0') echo -n -e "\r BiliBili Hongkong/Macau/Taiwan:\t${Font_Green}Yes${Font_Suffix}\n" ;; + '-10403') echo -n -e "\r BiliBili Hongkong/Macau/Taiwan:\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r BiliBili Hongkong/Macau/Taiwan:\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +# 流媒体解锁测试-哔哩哔哩台湾限定 +function MediaUnlockTest_BilibiliTW() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Bilibili Taiwan Only:\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local randsession=$(gen_uuid | md5sum | head -c 32) + # 尝试获取成功的结果 + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL "https://api.bilibili.com/pgc/player/web/playurl?avid=50762638&cid=100279344&qn=0&type=&otype=json&ep_id=268176&fourk=1&fnver=0&fnval=16&session=${randsession}&module=bangumi" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Bilibili Taiwan Only:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}\K[-\d]+' | head -n 1) + case "$result" in + '0') echo -n -e "\r Bilibili Taiwan Only:\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '-10403') echo -n -e "\r Bilibili Taiwan Only:\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Bilibili Taiwan Only:\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_AbemaTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Abema.TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://api.abema.io/v1/ip/check?device=android' --user-agent "${UA_ANDROID}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Abema.TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local region=$(echo "$tmpresult" | grep -woP '"isoCountryCode"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$region" ]; then + echo -n -e "\r Abema.TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$region" == 'JP' ]; then + echo -n -e "\r Abema.TV:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + else + echo -n -e "\r Abema.TV:\t\t\t\t${Font_Yellow}Oversea Only (Region: ${region})${Font_Suffix}\n" + fi +} + +function GameTest_PCRJP() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Princess Connect Re:Dive Japan:\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://api-priconne-redive.cygames.jp/' -w %{http_code} -o /dev/null --user-agent "${UA_ANDROID}") + + case "$result" in + '000') echo -n -e "\r Princess Connect Re:Dive Japan:\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '404') echo -n -e "\r Princess Connect Re:Dive Japan:\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r Princess Connect Re:Dive Japan:\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Princess Connect Re:Dive Japan:\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function GameTest_UMAJP() { + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://api-umamusume.cygames.jp/' -w %{http_code} -o /dev/null --user-agent "${UA_ANDROID}") + + case "$result" in + '000') echo -n -e "\r Pretty Derby Japan:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '404') echo -n -e "\r Pretty Derby Japan:\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r Pretty Derby Japan:\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Pretty Derby Japan:\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function GameTest_Kancolle() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Kancolle Japan:\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'http://203.104.209.7/kcscontents/twitter/maintenance_info.html' -w %{http_code} -o /dev/null --user-agent "${UA_ANDROID}") + # curl 'http://203.104.209.7/kcscontents/twitter/maintenance_info.html' \ + # -H 'Accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' \ + # -H 'Accept-Language: en-US,en;q=0.9' \ + # -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36' \ + # --insecure + + case "$result" in + '000') echo -n -e "\r Kancolle Japan:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r Kancolle Japan:\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r Kancolle Japan:\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Kancolle Japan:\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_Lemino() { + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://if.lemino.docomo.ne.jp/v1/user/delivery/watch/ready' -w %{http_code} -o /dev/null -H 'accept: application/json, text/plain, */*' -H 'accept-language: en-US,en;q=0.9' -H 'content-type: application/json' -H 'origin: https://lemino.docomo.ne.jp' -H 'referer: https://lemino.docomo.ne.jp/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H 'x-service-token: f365771afd91452fa279863f240c233d' -H 'x-trace-id: 556db33f-d739-4a82-84df-dd509a8aa179' --data-raw '{"inflow_flows":[null,"crid://plala.iptvf.jp/group/b100ce3"],"play_type":1,"key_download_only":null,"quality":null,"groupcast":null,"avail_status":"1","terminal_type":3,"test_account":0,"content_list":[{"kind":"main","service_id":null,"cid":"00lm78dz30","lid":"a0lsa6kum1","crid":"crid://plala.iptvf.jp/vod/0000000000_00lm78dymn","preview":0,"trailer":0,"auto_play":0,"stop_position":0}]}' --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r Lemino:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r Lemino:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r Lemino:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Lemino:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +MediaUnlockTest_AnimeFesta() { + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://api-animefesta.iowl.jp/v1/titles/1560' -w %{http_code} -o /dev/null -H 'accept: application/json' -H 'accept-language: en-US,en;q=0.9' -H 'anime-user-tracking-id: yEZr4P_U7JEdBucZOkv1Y' -H 'authorization;' -H 'origin: https://animefesta.iowl.jp' -H 'referer: https://animefesta.iowl.jp/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H 'sec-gpc: 1' -H 'x-requested-with: XMLHttpRequest' --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r AnimeFesta:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r AnimeFesta:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r AnimeFesta:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r AnimeFesta:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_mora() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Mora:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://mora.jp/buy?__requestToken=1713764407153&returnUrl=https%3A%2F%2Fmora.jp%2Fpackage%2F43000087%2FTFDS01006B00Z%2F%3Ffmid%3DTOPRNKS%26trackMaterialNo%3D31168909&fromMoraUx=false&deleteMaterial=' -w %{http_code} -o /dev/null -H 'host: mora.jp' --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r Mora:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r Mora:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r Mora:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '500') echo -n -e "\r Mora:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Mora:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_BBCiPLAYER() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r BBC iPLAYER:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://open.live.bbc.co.uk/mediaselector/6/select/version/2.0/mediaset/pc/vpid/bbc_one_london/format/json/jsfunc/JS_callbacks0' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r BBC iPLAYER:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -i 'geolocation') + local isOK=$(echo "$tmpresult" | grep -i 'vs-hls-push-uk') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r BBC iPLAYER:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r BBC iPLAYER:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r BBC iPLAYER:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r BBC iPLAYER:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_Netflix() { + # LEGO Ninjago + local result1=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.netflix.com/title/81280792' -w %{http_code} -o /dev/null -H 'host: www.netflix.com' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-site: none' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-user: ?1' -H 'sec-fetch-dest: document' --user-agent "${UA_BROWSER}") + # Breaking bad + local result2=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.netflix.com/title/70143836' -w %{http_code} -o /dev/null -H 'host: www.netflix.com' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-site: none' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-user: ?1' -H 'sec-fetch-dest: document' --user-agent "${UA_BROWSER}") + + if [ "${result1}" == '000' ] || [ "$result2" == '000' ]; then + echo -n -e "\r Netflix:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + if [ "$result1" == '404' ] && [ "$result2" == '404' ]; then + echo -n -e "\r Netflix:\t\t\t\t${Font_Yellow}Originals Only${Font_Suffix}\n" + return + fi + if [ "$result1" == '403' ] || [ "$result2" == '403' ]; then + echo -n -e "\r Netflix:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$result1" == '200' ] || [ "$result2" == '200' ]; then + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://www.netflix.com/' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-site: none' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-user: ?1' -H 'sec-fetch-dest: document' --user-agent "${UA_BROWSER}") + local region=$(echo "$tmpresult" | grep -oP '"id":"\K[^"]+' | grep -E '^[A-Z]{2}$' | head -n 1) + echo -n -e "\r Netflix:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r Netflix:\t\t\t\t\t${Font_Red}Failed (Error: ${result1}_${result2})${Font_Suffix}\n" +} + +function MediaUnlockTest_DisneyPlus() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Disney+:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tempresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://disney.api.edge.bamgrid.com/devices' -X POST -H "authorization: Bearer ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84" -H "content-type: application/json; charset=UTF-8" -d '{"deviceFamily":"browser","applicationRuntime":"chrome","deviceProfile":"windows","attributes":{}}' --user-agent "${UA_BROWSER}") + if [ -z "$tempresult" ]; then + echo -n -e "\r Disney+:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local is403=$(echo "$tempresult" | grep -i '403 ERROR') + if [ -n "$is403" ]; then + echo -n -e "\r Disney+:\t\t\t\t${Font_Red}No (IP Banned By Disney+)${Font_Suffix}\n" + return + fi + + local assertion=$(echo "$tempresult" | grep -woP '"assertion"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$assertion" ]; then + echo -n -e "\r Disney+:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + local preDisneyCookie=$(echo "$MEDIA_COOKIE" | sed -n '1p') + local disneyCookie=$(echo "$preDisneyCookie" | sed "s/DISNEYASSERTION/${assertion}/g") + local tokenContent=$(curl ${CURL_DEFAULT_OPTS} -s 'https://disney.api.edge.bamgrid.com/token' -X POST -H "authorization: Bearer ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84" -d "${disneyCookie}" --user-agent "${UA_BROWSER}") + + local isBlocked=$(echo "$tokenContent" | grep -i 'forbidden-location') + local is403=$(echo "$tokenContent" | grep -i '403 ERROR') + + if [ -n "$isBlocked" ] || [ -n "$is403" ]; then + echo -n -e "\r Disney+:\t\t\t\t${Font_Red}No (IP Banned By Disney+ 1)${Font_Suffix}\n" + return + fi + + local fakeContent=$(echo "$MEDIA_COOKIE" | sed -n '8p') + local refreshToken=$(echo "$tokenContent" | grep -woP '"refresh_token"\s{0,}:\s{0,}"\K[^"]+') + local disneyContent=$(echo "$fakeContent" | sed "s/ILOVEDISNEY/${refreshToken}/g") + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://disney.api.edge.bamgrid.com/graph/v1/device/graphql' -X POST -H "authorization: ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84" -d "${disneyContent}" --user-agent "${UA_BROWSER}") + + local previewcheck=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://disneyplus.com' -w '%{url_effective}\n' -o /dev/null --user-agent "${UA_BROWSER}") + local isUnavailable=$(echo "$previewcheck" | grep -E 'preview|unavailable') + local region=$(echo "$tmpresult" | grep -woP '"countryCode"\s{0,}:\s{0,}"\K[^"]+') + local inSupportedLocation=$(echo "$tmpresult" | grep -woP '"inSupportedLocation"\s{0,}:\s{0,}\K(false|true)') + + if [ -z "$region" ]; then + echo -n -e "\r Disney+:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$region" == 'JP' ]; then + echo -n -e "\r Disney+:\t\t\t\t${Font_Green}Yes (Region: JP)${Font_Suffix}\n" + return + fi + if [ -n "$isUnavailable" ]; then + echo -n -e "\r Disney+:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$inSupportedLocation" == 'false' ]; then + echo -n -e "\r Disney+:\t\t\t\t${Font_Yellow}Available For [Disney+ ${region}] Soon${Font_Suffix}\n" + return + fi + if [ "$inSupportedLocation" == 'true' ]; then + echo -n -e "\r Disney+:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r Disney+:\t\t\t\t${Font_Red}Failed (Error: ${inSupportedLocation}_${region})${Font_Suffix}\n" +} + +function MediaUnlockTest_Dazn() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Dazn:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://startup.core.indazn.com/misl/v5/Startup' -X POST -H "Content-Type: application/json" -d '{"LandingPageKey":"generic","languages":"en-US,en","Platform":"web","PlatformAttributes":{},"Manufacturer":"","PromoCode":"","Version":"2"}' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Dazn:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"isAllowed"\s{0,}:\s{0,}\K(false|true)') + local region=$(echo "$tmpresult" | grep -woP '"GeolocatedCountry"\s{0,}:\s{0,}"\K[^"]+' | tr a-z A-Z) + case "$result" in + 'false') echo -n -e "\r Dazn:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + 'true') echo -n -e "\r Dazn:\t\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" ;; + *) echo -n -e "\r Dazn:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_HuluJP() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Hulu Japan:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://id.hulu.jp/' -w '%{http_code}_TAG_%{url_effective}\n' -o /dev/null -H 'Accept: */*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: none' -H 'Sec-GPC: 1' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: document' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: none' -H 'Sec-Fetch-User: ?1' -H 'Priority: u=1' --user-agent "${UA_BROWSER}") + + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Hulu Japan:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local isBlocked=$(echo "$urlEffective" | grep 'restrict') + + if [ -n "$isBlocked" ]; then + echo -n -e "\r Hulu Japan:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + echo -n -e "\r Hulu Japan:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '403' ]; then + echo -n -e "\r Hulu Japan:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + echo -n -e "\r Hulu Japan:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_MyTVSuper() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r MyTVSuper:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://www.mytvsuper.com/api/auth/getSession/self/' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r MyTVSuper:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"country_code"\s{0,}:\s{0,}"\K[^"]+') + if [ "$result" == 'HK' ]; then + echo -n -e "\r MyTVSuper:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + else + echo -n -e "\r MyTVSuper:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + echo -n -e "\r MyTVSuper:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" +} + +function MediaUnlockTest_NowE() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Now E:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://webtvapi.nowe.com/16/1/getVodURL' \ + -H 'accept: application/json, text/javascript, */*; q=0.01' \ + -H 'accept-language: zh-CN,zh;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6' \ + -H 'content-type: text/plain' \ + -H 'origin: https://www.nowe.com' \ + -H 'priority: u=1, i' \ + -H 'referer: https://www.nowe.com/' \ + -H 'sec-fetch-dest: empty' \ + -H 'sec-fetch-mode: cors' \ + -H 'sec-fetch-site: same-site' \ + -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/131.0.0.0' \ + --data-raw '{"contentId":"202310181863841","contentType":"Vod","pin":"","deviceName":"Browser","deviceId":"w-678913af-3998-3998-3998-39983998","deviceType":"WEB","secureCookie":null,"callerReferenceNo":"W17370372345461425","profileId":null,"mupId":null,"trackId":"738296446.226.1737037103860.2","sessionId":"c39f03e6-9e74-4d24-a82f-e0d0f328bb70"}') + + if [ -z "$tmpresult" ]; then + echo -n -e "\r Now E:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"OTTAPI_ResponseCode"\s{0,}:\s{0,}"\K[^"]+') + case "$result" in + 'GEO_CHECK_FAIL') echo -n -e "\r Now E:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + 'SUCCESS') echo -n -e "\r Now E:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r Now E:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_ViuTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Viu.TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.viu.now.com/p8/3/getLiveURL' -X POST -H "Content-Type: application/json" -d '{"callerReferenceNo":"20210726112323","contentId":"099","contentType":"Channel","channelno":"099","mode":"prod","deviceId":"29b3cb117a635d5b56","deviceType":"ANDROID_WEB"}' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Viu.TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"responseCode"\s{0,}:\s{0,}"\K[^"]+') + case "$result" in + 'GEO_CHECK_FAIL') echo -n -e "\r Viu.TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + 'SUCCESS') echo -n -e "\r Viu.TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r Viu.TV:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_unext() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://cc.unext.jp' -H 'content-type: application/json' --data-raw '{"operationName":"cosmo_getPlaylistUrl","variables":{"code":"ED00479780","playMode":"caption","bitrateLow":192,"bitrateHigh":null,"validationOnly":false},"query":"query cosmo_getPlaylistUrl($code: String, $playMode: String, $bitrateLow: Int, $bitrateHigh: Int, $validationOnly: Boolean) {\n webfront_playlistUrl(\n code: $code\n playMode: $playMode\n bitrateLow: $bitrateLow\n bitrateHigh: $bitrateHigh\n validationOnly: $validationOnly\n ) {\n subTitle\n playToken\n playTokenHash\n beaconSpan\n result {\n errorCode\n errorMessage\n __typename\n }\n resultStatus\n licenseExpireDate\n urlInfo {\n code\n startPoint\n resumePoint\n endPoint\n endrollStartPosition\n holderId\n saleTypeCode\n sceneSearchList {\n IMS_AD1\n IMS_L\n IMS_M\n IMS_S\n __typename\n }\n movieProfile {\n cdnId\n type\n playlistUrl\n movieAudioList {\n audioType\n __typename\n }\n licenseUrlList {\n type\n licenseUrl\n __typename\n }\n __typename\n }\n umcContentId\n movieSecurityLevelCode\n captionFlg\n dubFlg\n commodityCode\n movieAudioList {\n audioType\n __typename\n }\n __typename\n }\n __typename\n }\n}\n"}' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r U-NEXT:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"resultStatus"\s{0,}:\s{0,}\K\d+') + case "$result" in + '475') echo -n -e "\r U-NEXT:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '200') echo -n -e "\r U-NEXT:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '467') echo -n -e "\r U-NEXT:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r U-NEXT:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_wowow() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r WOWOW:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local timestamp=$[$(date +%s%N)/1000000] + # 取原创剧集列表 + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s "https://www.wowow.co.jp/drama/original/json/lineup.json?_=${timestamp}" -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: https://www.wowow.co.jp/drama/original/' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-origin' -H 'X-Requested-With: XMLHttpRequest' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r WOWOW:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + # 取无料剧集来播放 example: https://www.wowow.co.jp/drama/original/hakubo/ + local playUrlList=$(echo "$tmpresult" | grep -woP '"link"\s{0,}:\s{0,}"\K[^"]+' | grep 'drama/original' | head -n 4 | xargs) + if [ -z "$playUrlList" ]; then + echo -n -e "\r WOWOW:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + for playUrl in $playUrlList ; do + # 访问并获取真实链接 + local tmpresult2=$(curl ${CURL_DEFAULT_OPTS} -s "${playUrl}" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult2" ]; then + echo -n -e "\r WOWOW:\t\t\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + + # 取得真实链接 + local wodUrl=$(echo "$tmpresult2" | grep -o '"https://wod.wowow.co.jp/content/.*"' | cut -f2 -d'"' | head -n 1) + if [ -n "$wodUrl" ]; then + break + fi + done + + if [ -z "$wodUrl" ]; then + echo -n -e "\r WOWOW:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR 1)${Font_Suffix}\n" + return + fi + + # 访问并获取 meta_id + local tmpresult3=$(curl ${CURL_DEFAULT_OPTS} -s "$wodUrl" -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + + if [ -z "$tmpresult3" ]; then + echo -n -e "\r WOWOW:\t\t\t\t\t${Font_Red}Failed (Network Connection 2)${Font_Suffix}\n" + return + fi + + local metaId=$(echo "$tmpresult3" | grep -woP '"https://wod.wowow.co.jp/watch/\K\d{0,}[^"]+') + # Fake Vistor UID + local vUid=$(echo -n "$timestamp" | md5sum | cut -f1 -d' ') + # 最终测试 + local tmpresult4=$(curl ${CURL_DEFAULT_OPTS} -s 'https://mapi.wowow.co.jp/api/v1/playback/auth' -H 'accept: application/json, text/plain, */*' -H 'content-type: application/json;charset=UTF-8' -H 'origin: https://wod.wowow.co.jp' -H 'referer: https://wod.wowow.co.jp/' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H 'x-requested-with: XMLHttpRequest' --data-raw "{\"meta_id\":${metaId},\"vuid\":\"${vUid}\",\"device_code\":1,\"app_id\":1,\"ua\":\"${UA_BROWSER}\"}" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult4" ]; then + echo -n -e "\r WOWOW:\t\t\t\t\t${Font_Red}Failed (Network Connection 3)${Font_Suffix}\n" + return + fi + local isBlocked=$(echo "$tmpresult4" | grep -i 'VPN') + local isOK=$(echo "$tmpresult4" | grep -i 'playback_session_id') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r WOWOW:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR 2)${Font_Suffix}\n" + return + fi + + if [ -n "$isBlocked" ]; then + echo -n -e "\r WOWOW:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r WOWOW:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r WOWOW:\t\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_TVer() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r TVer:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://platform-api.tver.jp/v2/api/platform_users/browser/create' -H 'content-type: application/x-www-form-urlencoded' -H 'origin: https://s.tver.jp' -H 'referer: https://s.tver.jp/' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' --data-raw 'device_type=pc' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r TVer:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + # 先取 UID 和 TOKEN + local platformUid=$(echo "$tmpresult" | grep -woP '"platform_uid"\s{0,}:\s{0,}"\K[^"]+') + local platformToken=$(echo "$tmpresult" | grep -woP '"platform_token"\s{0,}:\s{0,}"\K[^"]+') + # 根据 UID 和 TOKEN 取得当前正在播放的剧集 + local tmpresult2=$(curl ${CURL_DEFAULT_OPTS} -s "https://platform-api.tver.jp/service/api/v1/callHome?platform_uid=${platformUid}&platform_token=${platformToken}&require_data=mylist%2Cresume%2Clater" -H 'origin: https://tver.jp' -H 'referer: https://tver.jp/' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H 'x-tver-platform-type: web' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult2" ]; then + echo -n -e "\r TVer:\t\t\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + # 返回结果取新电视剧第一个值 + # echo "$tmpresult2" | jq -r '.result.components.[] | select(.componentID | contains("newer-drama")) | limit(1; .contents.[].content.id)' + local episodeId=$(echo "$tmpresult2" | sed -E 's/.*"variety.catchup.recomend([.]{0,})"//' | sed 's/"componentID".*//' | sed 's/"id"/_TAG_/;s/.*_TAG_//' | cut -f2 -d'"' | grep -E '[a-z0-9]{10}') + if [ -z "$episodeId" ]; then + echo -n -e "\r TVer:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + # 取得该剧集信息 + local tmpresult3=$(curl ${CURL_DEFAULT_OPTS} -s "https://statics.tver.jp/content/episode/${episodeId}.json" -H 'origin: https://tver.jp' -H 'referer: https://tver.jp/' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult3" ]; then + echo -n -e "\r TVer:\t\t\t\t\t${Font_Red}Failed (Network Connection 2)${Font_Suffix}\n" + return + fi + # 取 accountID / playerID / videoID / videoRefID + local accountID=$(echo "$tmpresult3" | grep -woP '"accountID"\s{0,}:\s{0,}"\K[^"]+') + local playerID=$(echo "$tmpresult3" | grep -woP '"playerID"\s{0,}:\s{0,}"\K[^"]+') + local videoID=$(echo "$tmpresult3" | grep -woP '"videoID"\s{0,}:\s{0,}"\K[^"]+') + local videoRefID=$(echo "$tmpresult3" | grep -woP '"videoRefID"\s{0,}:\s{0,}"\K[^"]+' | head -n 1) + # 取得 brightcove 播放器信息 + local tmpresult4=$(curl ${CURL_DEFAULT_OPTS} -s "https://players.brightcove.net/${accountID}/${playerID}_default/index.min.js" -H 'Referer: https://tver.jp/' -H 'Sec-Fetch-Dest: script' -H 'Sec-Fetch-Mode: no-cors' -H 'Sec-Fetch-Site: cross-site' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult4" ]; then + echo -n -e "\r TVer:\t\t\t\t\t${Font_Red}Failed (Network Connection 3)${Font_Suffix}\n" + return + fi + # 取 policy_key + local policyKey=$(echo "$tmpresult4" | sed 's/.*policyKey:"//' | awk -F'"' '{print $1}') + + if [ -z "${videoRefID}" ]; then + # 取 deliveryConfigId + local deliveryConfigId=$(echo "$tmpresult4" | sed 's/.*deliveryConfigId:"//' | awk -F'"' '{print $1}') + # 最终检查 + local tmpresult5=$(curl ${CURL_DEFAULT_OPTS} -s "https://edge.api.brightcove.com/playback/v1/accounts/${accountID}/videos/${videoID}?config_id=${deliveryConfigId}" -H "accept: application/json;pk=${policyKey}" -H 'origin: https://tver.jp' -H 'referer: https://tver.jp/' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: cross-site' --user-agent "${UA_BROWSER}") + else + # 最终检查 + local tmpresult5=$(curl ${CURL_DEFAULT_OPTS} -s "https://edge.api.brightcove.com/playback/v1/accounts/${accountID}/videos/ref%3A${videoRefID}" -H "accept: application/json;pk=${policyKey}" -H 'origin: https://tver.jp' -H 'referer: https://tver.jp/' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: cross-site' --user-agent "${UA_BROWSER}") + fi + + if [ -z "$tmpresult5" ]; then + echo -n -e "\r TVer:\t\t\t\t\t${Font_Red}Failed (Network Connection 4)${Font_Suffix}\n" + return + fi + local result=$(echo "$tmpresult5" | grep -woP '"error_subcode"\s{0,}:\s{0,}"\K[^"]+') + case "$result" in + 'CLIENT_GEO') echo -n -e "\r TVer:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '') echo -n -e "\r TVer:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r TVer:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_HamiVideo() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Hami Video:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://hamivideo.hinet.net/api/play.do?id=OTT_VOD_0000249064&freeProduct=1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Hami Video:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}"\K[^"]+') + case "$result" in + '06001-106') echo -n -e "\r Hami Video:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '06001-107') echo -n -e "\r Hami Video:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r Hami Video:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_4GTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r 4GTV.TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} --tlsv1.3 -s 'https://api2.4gtv.tv/Web/IsTaiwanArea' -H 'origin: https://www.4gtv.tv' -H 'referer: https://www.4gtv.tv/' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r 4GTV.TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + result=$(echo "$tmpresult" | grep -woP '"Data"\s{0,}:\s{0,}"\K[^"]+') + case "$result" in + 'N') echo -n -e "\r 4GTV.TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + 'Y') echo -n -e "\r 4GTV.TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r 4GTV.TV:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_SlingTV() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.sling.com/' -w '%{http_code}_TAG_%{url_effective}\n' -o /dev/null --user-agent "${UA_BROWSER}") + + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Sling TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local isBlocked=$(echo "$urlEffective" | grep -i 'geo-block') + + if [ -n "$isBlocked" ]; then + echo -n -e "\r Sling TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + echo -n -e "\r Sling TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Sling TV:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_PlutoTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Pluto TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://pluto.tv/' -w '%{http_code}_TAG_%{url_effective}\n' -o /dev/null --user-agent "${UA_BROWSER}") + + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Pluto TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local isBlocked=$(echo "$urlEffective" | grep 'plutotv-is-not-available') + + if [ -n "$isBlocked" ]; then + echo -n -e "\r Pluto TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + echo -n -e "\r Pluto TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Pluto TV:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_HBOMax() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sLi 'https://www.max.com/' -w "_TAG_%{http_code}_TAG_" --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | grep '_TAG_' | awk -F'_TAG_' '{print $2}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r HBO Max:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local countryList=$(echo "$tmpresult" | grep -woP '"url":"/[a-z]{2}/[a-z]{2}"' | cut -f4 -d'"' | cut -f2 -d'/' | sort -n | uniq | xargs | tr a-z A-Z) + local countryList="${countryList} US" + local region=$(echo "$tmpresult" | grep -woP 'countryCode=\K[A-Z]{2}' | head -n 1) + local isUnavailable=$(echo "$countryList" | grep "$region") + + if [ -z "$region" ]; then + echo -n -e "\r HBO Max:\t\t\t\t${Font_Red}Failed (Error: Country Code Not Found)${Font_Suffix}\n" + return + fi + if [ -n "$isUnavailable" ]; then + echo -n -e "\r HBO Max:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r HBO Max:\t\t\t\t${Font_Red}No${Font_Suffix}\n" +} + +function MediaUnlockTest_Showmax() { + local region=$(curl ${CURL_DEFAULT_OPTS} -si 'https://www.showmax.com/' -H 'host: www.showmax.com' -H 'connection: keep-alive' -H 'sec-ch-ua: "Chromium";v="124", "Microsoft Edge";v="124", "Not-A.Brand";v="99"' -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'upgrade-insecure-requests: 1' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0' -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'sec-fetch-site: none' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-user: ?1' -H 'sec-fetch-dest: document' -H 'accept-language: zh-CN,zh;q=0.9' 2>&1 | grep 'activeTerritory'| awk -F'[=;]' '{print $2}') + if [[ "$region" == "curl"* ]]; then + echo -n -e "\r Showmax:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + if [ -n "$region" ]; then + echo -n -e "\r Showmax:\t\t\t\t${Font_Green}Yes (Region: $region)${Font_Suffix}\n" + return + elif [ -z "$region" ]; then + echo -n -e "\r Showmax:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + else + echo -n -e "\r Showmax:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi +} + +function MediaUnlockTest_Channel4() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Channel 4:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.channel4.com/simulcast/channels/C4' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r Channel 4:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '403') echo -n -e "\r Channel 4:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '200') echo -n -e "\r Channel 4:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r Channel 4:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_ITVHUB() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r ITV Hub:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://magni.itv.com/playlist/itvonline/ITV/10_4782_0001.001' -H 'Accept: application/vnd.itv.vod.playlist.v2+json' -H 'Accept-Language: en-US,en;q=0.9' -H 'Content-Type: application/json' -H 'Origin: https://www.itv.com' -H 'Referer: https://www.itv.com/' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-site' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' --data-raw '{"user":{"entitlements":[]},"device":{"manufacturer":"Chrome","model":"125.0.0.0","os":{"name":"Windows","version":"10","type":"desktop"}},"client":{"version":"4.1","id":"browser","supportsAdPods":true,"service":"itv.x","appversion":"2.237.0"},"variantAvailability":{"player":"dash","featureset":{"min":["mpeg-dash","widevine","outband-webvtt","hd","single-track"],"max":["mpeg-dash","widevine","outband-webvtt","hd","single-track"]},"platformTag":"dotcom"}}' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r ITV Hub:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -i 'Outside Of Allowed Geographic') + local isOK=$(echo "$tmpresult" | grep -i 'Playlist') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r ITV Hub:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r ITV Hub:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r ITV Hub:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r ITV Hub:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_DSTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r DSTV:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL --tlsv1.3 'https://authentication.dstv.com/favicon.ico' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r DSTV:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '403'|'451') echo -n -e "\r DSTV:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '404') echo -n -e "\r DSTV:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r DSTV:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function RegionTest_iQYI() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r iQyi Oversea Region:\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://www.iq.com/' -w "_TAG_%{http_code}_TAG_" -o /dev/null --user-agent "${UA_BROWSER}" -D -) + + local httpCode=$(echo "$tmpresult" | grep '_TAG_' | awk -F'_TAG_' '{print $2}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r iQyi Oversea Region:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local region=$(echo "$tmpresult" | grep -woP 'mod=\K[a-z]+' | tr a-z A-Z) + if [ -z "$region" ]; then + echo -n -e "\r iQyi Oversea Region:\t\t\t${Font_Red}Failed (Error: Country Code Not Found)${Font_Suffix}\n" + return + fi + + if [ "$region" == 'NTW' ]; then + region='TW' + fi + + echo -n -e "\r iQyi Oversea Region:\t\t\t${Font_Green}${region}${Font_Suffix}\n" +} + +function MediaUnlockTest_HuluUS() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://auth.hulu.com/v4/web/password/authenticate' -H 'Accept: application/json' -H 'accept-language: en-US,en;q=0.9' -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' -H 'Cookie: _hulu_at=eyJhbGciOiJSUzI1NiJ9.eyJhc3NpZ25tZW50cyI6ImV5SjJNU0k2VzExOSIsInJlZnJlc2hfaW50ZXJ2YWwiOjg2NDAwMDAwLCJ0b2tlbl9pZCI6IjQyZDk0YzA5LWYyZTEtNDdmNC1iYzU4LWUwNTA2NGNhYTdhZCIsImFub255bW91c19pZCI6IjYzNDUzMjA2LWFmYzgtNDU4Yi1iODBkLWNiMzk2MmYzZGQyZCIsImlzc3VlZF9hdCI6MTcwNjYwOTUzODc5MiwidHRsIjozMTUzNjAwMDAwMCwiZGV2aWNlX3VwcGVyIjoxfQ.e7sRCOndgn1j30XYkenLcLSQ7vwc2PXk-gFHMIF2gu_3UNEJ3pp3xNOZMN0n7DQRw5Jv68WiGxIvf65s8AetOoD4NLt4sZUDDz9HCRmFHzpmAJdtXWZ-HZ4fYucENuqDDDrsdQ-FCc0mgIe2IXkmQJ6tpIN3Zgcgmpmbeoq6jYyLlqg6f8eMsI1bNAsBGGj-9DXw2PMotlYHWB22pw2NRfJw1TjWXwywRBodAOve7rsu2Vhx-A2-OH4GplRvxLqzCpl2pcjkYg9atmUB7jnNIf_jHqlek4oRRawahWq-2vWnWmb1eMQcH-v2IHs3YdVk7I-t4iS19auPQrdgo6jPaA; _hulu_assignments=eyJ2MSI6W119; bm_mi=8896E057E2FC39F20852615A0C46A2B4~YAAQZB0gFyQrnlSNAQAAU/naWRaCMaJFIPi3L8KYSiCL3AN7XHCPw0gKvdIl0XZ/VE3QiKEr31qjm9sPulHbdQ4XXIXPXZ53DpIK43fLybrT6WxIpmGz3iThk6+xefI2dPLzwBAdoTrsbAbHC2q4LDx0SBM+n21LvTD7UnT2+DyVBK75YCDJJKHlJ5jzB3Q81JIlmqfTzibjgVmPIxXrFdTs5Ll8mtp6WzE3VDISmjGjTRTrSOVYM0YGpyhye1nsm3zBCO13vDjKMCJ/6oAsVqBfgfW07e7sWkWeUiDYLUifRDymc4GaMhavenBvCma/G1qW~1; bm_sv=FEE04D9D797D0237C312D77F57DABBFD~YAAQZB0gFyUrnlSNAQAAU/naWRaMNI8KmoGX9XNJkm9x9VeeGzGQyPfu49M9MnLObz8D4ZYk9Td+3Y8Z/Jfx+kl2qOPXmtOC5GZpA++9bxUKV0SwaoGhivl+ibIJSQTc7lw4kzdM/2w8b3rwItRaHXFa+shMtD3eiKvBePrqCiezucqrcss1U4ojLKEOvcsKJGt6ZTGGs2H+Qu6cyns9BVN0BprMHRY3njHXyxbFIcGy8Lq7aPn6nuZ0ehfZ9Q==~1; ak_bmsc=55F791116713DDB91AB0978225853B77~000000000000000000000000000000~YAAQZB0gF6ErnlSNAQAAHALbWRaA625r4bWVW8g2gHV797RN8bfCwNy6KfnGEucUPiPt4QKjJUldR6lyaM7sarag6A7WLqxEFr/zAFlPQI12Uxsqdzg3IgU0R8g2eMQRnRoGMNSUPyt4rdCWWwGjEcM+dQ8TI+y1vKw9dLXoBJAHofaWe/dZhY4fx2mYKhKFibvdpwJT6UPe4rBz8igd9oTQBn69Ebi6/9YFykqGuKsllxa5+QZWczb0+HLLDRKV4CkZdhbFj0yljEOyz4GHqqP8qg3Xa3lCKzdzsrmPn6zdFbgzCE8HsyPjsmy+/rRfFxagH5rYudLqFXg5o5dXFFJPTiLXtZ/S30ckc/OUWk4JP2ywAQVm/zbp8nlRVMFDEdjIPh/F+5QXfYBV+yL4a85ThlBEXSr54/QWXiHxBRiOwhv2ydoZDfT78r9bUHbMOra37C0xutfo37fbYEw9LWlLdZCub9U5HA/zSeIN3KxrZr0yNKfJjOau7BqdHL+AuvDj134ZPZPVig==; _customer_type=anonymous; s_fid=66C80912997F4CF8-2D3140F8EDC76274; s_cc=true; _rdt_uuid=1706609517486.d5b309e4-2b0b-440f-9817-cf619e4ce15d; _gcl_au=1.1.602757068.1706609518; _scid=cc980fef-26dc-479a-b9a8-b0e531c87cd3; _scid_r=cc980fef-26dc-479a-b9a8-b0e531c87cd3; _tt_enable_cookie=1; _ttp=1h5M9exzlSz7wAFDR78KCHCsnDC; utag_main=v_id:018d59da9a5c00215e601dada5700507d001c07500bd0$_sn:1$_ss:0$_st:1706611329541$ses_id:1706609515101%3Bexp-session$_pn:1%3Bexp-session$_prevpage:%2Fwelcome%3Bexp-1706613129564$trial_duration:undefined%3Bexp-session$program_id:undefined%3Bexp-session$vapi_domain:hulu.com$g_sync_ran:1%3Bexp-session$dc_visit:1$dc_event:1%3Bexp-session$dc_region:ap-east-1%3Bexp-session; _hulu_metrics_context_v1_=%7B%22cookie_session_guid%22%3A%227dc4f3a6826f2c35125268f5ddab1849%22%2C%22referrer_url%22%3A%22%22%2C%22curr_page_uri%22%3A%22www.hulu.com%2Fwelcome%22%2C%22primary_ref_page_uri%22%3Anull%2C%22secondary_ref_page_uri%22%3Anull%2C%22curr_page_type%22%3A%22landing%22%2C%22primary_ref_page_type%22%3Anull%2C%22secondary_ref_page_type%22%3Anull%2C%22secondary_ref_click%22%3A%22%22%2C%22primary_ref_click%22%3A%22%22%7D; metrics_tracker_session_manager=%7B%22session_id%22%3A%22B26515EB8A7952D4D35F374465362A72-529671c4-c8c2-4c7c-8bff-cc201bcd4075%22%2C%22creation_time%22%3A1706609513429%2C%22visit_count%22%3A1%2C%22session_seq%22%3A4%2C%22idle_time%22%3A1706609529579%7D; guid=B26515EB8A7952D4D35F374465362A72; JSESSIONID=ED7031784C3B1843BFC9AACBB156C6BA; s_sq=wdghuluwebprod%3D%2526c.%2526a.%2526activitymap.%2526page%253Dwelcome%2526link%253DLOG%252520IN%2526region%253Dlogin-modal%2526pageIDType%253D1%2526.activitymap%2526.a%2526.c%2526pid%253Dwelcome%2526pidt%253D1%2526oid%253Dfunctionsn%252528%252529%25257B%25257D%2526oidt%253D2%2526ot%253DBUTTON; XSRF-TOKEN=bcfa1766-1f73-442d-a71b-e1cf6c275f45; _h_csrf_id=2a52618e9d006ac2e0b3e65740aa55e2584359553466051c3b01a2f1fb91726a' -H 'Origin: https://www.hulu.com' -H 'Referer: https://www.hulu.com/welcome' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-site' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' --data-raw 'user_email=me%40jamchoi.cc&password=Jam0.5cm~&recaptcha_type=web_invisible&rrventerprise=03AFcWeA6UFet_b_82RUmGfFWJCWuqy6kIn854Rhqjwd7vrkjH6Vku1wBZy8-FBA3Efx1p2cuNnKeJRuk7yJWm-xZgFfUx0Wdj2OAhiGvIdWrcpfeuQSXEqaXH4FKdmAHVZ3EqHwe5-h_zgtcyIxq-Nn1-sjeUfx1Y7QyVkb_GWJcr0GLoKgTFLzbF4kmJ8Qsi4IFx9hyYo9TFbBqtYdgxCI2q9DnEzOHrxK-987PEY8qzsR08Hrb9oDvumqLp1gs4uEVTwDKWt37aNB3CMVBKL2lHj7n768kXpgkXFDIhcM2eiJJ-H22qxKzNUpg-Q_N1xzkYsavCJG3ckQgsCTRRP2NU3nIERTWDTVXRBEq52-_ZQWu_Ds4W4UZyP0hEhCD2gambN4YJqEzaeHdGPwOR943nFbG6GILBx4vY-UUc7zjMf2HRjkNPvPpQiHMIYo21JXq6l8-IWyTeHY26NU6M4vCCbzwZEsdSln48rXM_fdBcDHC-8AxUFuBR8j3DMsB6Q3xMS2EHeGVrmhDY1izDNJZsVC_cN0W2tRneOJmni7ZU1iAYoBAGBBM5FDTE4UbYUTnuUn-htm9Q0RzukpYTumF_WwQ3HnEL0JK1Q1xea-hteI8lB4oAkhVOBOHVPii9atdZR9ZLpxRh1pdy3Lwmr1ltsubxE05wqmrmt33P2WsvH_3nBJXC_FhTD06BxT60RuiGtFr2gscHjjl_NCa1F-Dv9Hgi5ek2nLHK37a84bRSoKwLL3Lnpi9byuBntlpf-UXj7nveawKZmZTUBOSc7j6Vmmf124DTPJXsFeofMfUXkqTauPTWJBOz0OdKnLKDHMSsk7oSJVKsDUEeq0iKMdtCMBPvQBaPYAb79LDRwv_ereqyklKcUKQxeZRZmEXLKIWp8BS4U9uTXA2w8hwZWe7goLnUBQATIwojeHKpypSLnzQBu9JCwMU4aXfKIplL8sXuAx3QFD52eGZSCEyuFXP3ACN53QOlTAjjlP2eDT9fEwWHT4o8eJfviyjvm8xDmzKtq4F3u5XB3tL86-dK40XYbGcTI0Irw1nz1UTcxplFgHQgb6i8WEAqb69CQkpGWAUlmnknBirRAv2adqPaW2d_lv6L3Eo-ZupWcZ9Cu4PibM5BruVNXifBwPNPXHKw-sWBj-UP1g9VtxHVEVwoTXrbB-lT8EvjDEDQKrvOwnri4_tzVzn6YKvQMELbxSegvmc2w7xypT2qFzKRFXqwTMLT9d0rf2p9tbwbe39REMR8oI7wPfbjyJjK2XF4DmEAyVvBMuJlBaBsKBs5VynITHFWs4xvkAOe4jO_fzkKXzB6F6DB03ldasxbrNK_cepUOF6FD39-pHvbAGcoTrDrx6FSfecYXwSvc3GxM3IHSKwISKWav2iqPMtIt6ClCgUPgTCBDng2ZptXeVG8FckGIGMEdVlgGt5DG2tdMO2p8Hs5tKXuu8anc_csaaSfLIQ1_kav0dp8vpSXhCxeg899o5coXderUoIBcUsfaBJJm80YnCAc4LaM8HmYtJBcKqCC_uwCckPDOuC0SQy3d07LEi6wyifvY0Kv_-ER6wXvhNWnDZIXJNlH2369X7y8o3y2HMisOwAhfmKN7_ZAaODEOO-5x9JHocAYnt4a8_focwU9JQ_hUQgtdzYpP1ACEqxVjJb0A0NlABpm-CG8V9n9y6XpZkGQiMYJIH3jr6VilHSEM9rQSEv6LN8NFigl3-5Y4Ri7W4joz3LUMQcjFj3qXd3AXonarXhwglVNB9BYquCdA5eq4wVUeAkm3R-e56TK5IZwpb5wNJDO3PhuXHSMwv1k-NEAIfI9_w&scenario=web_password_login&csrf=c2c20e89ce4e314771dcda79994b2cd020b9c30fc25faccdc1ebef3351a5b36b' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Hulu:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"name"\s{0,}:\s{0,}"\K[^"]+') + case "$result" in + 'LOGIN_FORBIDDEN') echo -n -e "\r Hulu:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + 'GEO_BLOCKED') echo -n -e "\r Hulu:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '' ) echo -n -e "\r Hulu:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" ;; + *) echo -n -e "\r Hulu:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_encoreTVB() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r encoreTVB:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://edge.api.brightcove.com/playback/v1/accounts/5324042807001/videos/6005570109001' -H "Accept: application/json;pk=BCpkADawqM2Gpjj8SlY2mj4FgJJMfUpxTNtHWXOItY1PvamzxGstJbsgc-zFOHkCVcKeeOhPUd9MNHEGJoVy1By1Hrlh9rOXArC5M5MTcChJGU6maC8qhQ4Y8W-QYtvi8Nq34bUb9IOvoKBLeNF4D9Avskfe9rtMoEjj6ImXu_i4oIhYS0dx7x1AgHvtAaZFFhq3LBGtR-ZcsSqxNzVg-4PRUI9zcytQkk_YJXndNSfhVdmYmnxkgx1XXisGv1FG5GOmEK4jZ_Ih0riX5icFnHrgniADr4bA2G7TYh4OeGBrYLyFN_BDOvq3nFGrXVWrTLhaYyjxOr4rZqJPKK2ybmMsq466Ke1ZtE-wNQ" -H "Origin: https://www.encoretvb.com" -H 'accept-language: en-US,en;q=0.9' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r encoreTVB:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"error_subcode"\s{0,}:\s{0,}"\K[^"]+') + case "$result" in + 'CLIENT_GEO') echo -n -e "\r encoreTVB:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '') echo -n -e "\r encoreTVB:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r encoreTVB:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_Molotov() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://fapi.molotov.tv/v1/open-europe/is-france' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Molotov:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"is_france"\s{0,}:\s{0,}\K(false|true)') + + case "$result" in + 'false') echo -n -e "\r Molotov:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + 'true') echo -n -e "\r Molotov:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '') echo -n -e "\r Molotov:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" ;; + *) echo -n -e "\r Molotov:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_LineTVTW() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r LineTV.TW:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://www.linetv.tw/' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r LineTV.TW:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + # 找 main js 的链接 + local mainJsUrl=$(echo "$tmpresult" | grep -woP 'src="\K[^"]+' | grep -E '/main-[a-z0-9]{8}') + # 下载 main js + local tmpresult2=$(curl ${CURL_DEFAULT_OPTS} -s "${mainJsUrl}" -H 'referer: https://www.linetv.tw/' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult2" ]; then + echo -n -e "\r LineTV.TW:\t\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + # 从 main js 里找 appId + local appId=$(echo "$tmpresult2" | grep -woP 'appId:"\K[^"]+' | head -n 1) + # 正式测试 + local tmpresult3=$(curl ${CURL_DEFAULT_OPTS} -s "https://www.linetv.tw/api/part/11829/eps/1/part?appId=${appId}&productType=FAST&version=10.38.0" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult3" ]; then + echo -n -e "\r LineTV.TW:\t\t\t\t${Font_Red}Failed (Network Connection 2)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult3" | grep -woP '"countryCode"\s{0,}:\s{0,}\K\d+') + case "$result" in + '228') echo -n -e "\r LineTV.TW:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '') echo -n -e "\r LineTV.TW:\t\t\t\t${Font_Red}Failed (Error: Country Code Not Found)${Font_Suffix}\n" ;; + *) echo -n -e "\r LineTV.TW:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_ViuCom() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Viu.com:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.viu.com/' -w '%{http_code}_TAG_%{url_effective}\n' -o /dev/null --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Viu.com:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local region=$(echo "$urlEffective" | cut -f5 -d'/' | tr a-z A-Z) + if [ -z "$region" ]; then + echo -n -e "\r Viu.com:\t\t\t\t${Font_Red}Failed (Error: Country Code Not Found)${Font_Suffix}\n" + return + fi + if [ "$region" == 'NO-SERVICE' ]; then + echo -n -e "\r Viu.com:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + echo -n -e "\r Viu.com:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r Viu.com:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_Niconico() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Niconico:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://www.nicovideo.jp/watch/so23017073' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Niconico:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + # 获取直播网页 + local tmpresult2=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://live.nicovideo.jp/?cmnhd_ref=device=pc&site=nicolive&pos=header_servicelink&ref=WatchPage-Anchor' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult2" ]; then + echo -n -e "\r Niconico:\t\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + + # 从直播网页中找到第一个官方直播剧 + # echo "$tmpresult2" | grep -woP 'id="DAT-csr-data" data-value="[^"]+' | sed 's/id="DAT-csr-data" data-value="//;s/"/"/g' | \ + # jq -r '.props.view.popularBeforeOpenBroadcastStatusProgramListSectionState.programList.[] | select(.isOfficialChannelMemberFree == false) | .id' | head -n 1 + local liveID=$(echo "$tmpresult2" | sed 's/"isOfficialChannelMemberFree":false/"isOfficialChannelMemberFree":false\r\n/g' | grep -v '"isOfficialChannelMemberFree":true' | grep -v -E 'playerProgram|"ON_AIR"' | grep '話' | grep -woP '"id":"\Klv[0-9]+' | head -n 1) + if [ -z "$liveID" ]; then + echo -n -e "\r Niconico:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + local tmpresult3=$(curl ${CURL_DEFAULT_OPTS} -sL "https://live.nicovideo.jp/watch/${liveID}" -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult3" ]; then + echo -n -e "\r Niconico:\t\t\t\t${Font_Red}Failed (Network Connection 2)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep '同じ地域') + local isJapanOnly=$(echo "$tmpresult3" | grep 'notAllowedCountry') + + if [ -z "$isBlocked" ] && [ -z "$isJapanOnly" ]; then + echo -n -e "\r Niconico:\t\t\t\t${Font_Green}Yes (LiveID: $liveID)${Font_Suffix}\n" + return + fi + + if [ -n "$isBlocked" ]; then + echo -n -e "\r Niconico:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + if [ -n "$isJapanOnly" ]; then + echo -n -e "\r Niconico:\t\t\t\t${Font_Yellow}No (Official Live Unavailable. LiveID: ${liveID})${Font_Suffix}\n" + return + fi + + echo -n -e "\r Niconico:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_ParamountPlus() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.paramountplus.com/' -w '%{http_code}_TAG_%{url_effective}\n' -o /dev/null --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Paramount+:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local region=$(echo "$urlEffective" | cut -f4 -d'/' | tr a-z A-Z) + + if [ "$region" == 'INTL' ]; then + echo -n -e "\r Paramount+:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + if [ -z "$region" ]; then + local region='US' + fi + echo -n -e "\r Paramount+:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r Paramount+:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_KKTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r KKTV:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.kktv.me/v3/ipcheck' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r KKTV:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + result=$(echo "$tmpresult" | grep -woP '"country"\s{0,}:\s{0,}"\K[^"]+') + if [ "$result" == 'TW' ]; then + echo -n -e "\r KKTV:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r KKTV:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" +} + +function MediaUnlockTest_PeacockTV() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.peacocktv.com/' -w '%{http_code}_TAG_%{url_effective}\n' -o dev/null --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Peacock TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local result=$(echo "$urlEffective" | grep -i 'unavailable') + + if [ -n "$result" ]; then + echo -n -e "\r Peacock TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + echo -n -e "\r Peacock TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Peacock TV:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_FOD() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r FOD(Fuji TV):\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://geocontrol1.stream.ne.jp/fod-geo/check.xml?time=1624504256' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r FOD(Fuji TV):\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '\K[^<(]+') + if [ -z "$result" ]; then + echo -n -e "\r Google Play Store:\t\t\t${Font_Red}Failed${Font_Suffix}\n" + return + else + echo -n -e "\r Google Play Store:\t\t\t${Font_Green}${result}${Font_Suffix}\n" + return + fi +} + +function RegionTest_Apple() { + local result=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://gspe1-ssl.ls.apple.com/pep/gcc') + if [ -z "$result" ]; then + echo -n -e "\r Apple Region:\t\t\t\t${Font_Red}Failed${Font_Suffix}\n" + return + else + echo -n -e "\r Apple Region:\t\t\t\t${Font_Green}${result}${Font_Suffix}\n" + return + fi +} + +function RegionTest_YouTubeCDN() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://redirector.googlevideo.com/report_mapping' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r YouTube CDN:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local iata=$(echo "$tmpresult" | grep '=>' | awk "NR==1" | awk '{print $3}' | cut -f2 -d'-' | cut -c 1-3 | tr a-z A-Z) + local isIDC=$(echo "$tmpresult" | grep 'router') + local isIataFound1=$(echo "$IATACODE" | grep -w "$iata") + local isIataFound2=$(echo "$IATACODE2" | grep -w "$iata") + + if [ -z "$iata" ]; then + echo -n -e "\r YouTube CDN:\t\t\t\t${Font_Red}Failed (Error: Location Unknown)${Font_Suffix}\n" + return + fi + if [ -z "$isIataFound1" ] && [ -z "$isIataFound2" ]; then + echo -n -e "\r YouTube CDN:\t\t\t\t${Font_Red}Failed (Error: IATA: ${iata} Not Found)${Font_Suffix}\n" + return + fi + if [ -n "$isIataFound1" ]; then + local location=$(echo "$IATACODE" | grep -w "$iata" | awk -F'|' '{print $1}' | awk '{$1=$1; print}') + fi + if [ -z "$isIataFound1" ] && [ -n "$isIataFound2" ]; then + local location=$(echo "$IATACODE2" | grep -w "$iata" | awk -F',' '{print $2}' | awk '{$1=$1; print}' | tr A-Z a-z | sed 's/\b[a-z]/\U&/g') + fi + + if [ -z "$isIDC" ]; then + local cdnISP=$(echo "$tmpresult" | awk 'NR==1' | awk '{print $3}' | cut -f1 -d'-' | tr a-z A-Z) + echo -n -e "\r YouTube CDN:\t\t\t\t${Font_Yellow}[${cdnISP}] in [${location}]${Font_Suffix}\n" + return + fi + if [ -n "$isIDC" ]; then + echo -n -e "\r YouTube CDN:\t\t\t\t${Font_Green}${location}${Font_Suffix}\n" + return + fi + + echo -n -e "\r YouTube CDN:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function WebTest_GoogleSearchCAPTCHA() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://www.google.com/search?q=curl&oq=curl&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBBzg1MmowajGoAgCwAgE&sourceid=chrome&ie=UTF-8' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-model: ""' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-ch-ua-platform-version: "15.0.0"' -H 'sec-ch-ua-wow64: ?0' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Google Search CAPTCHA Free:\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -iE 'unusual traffic from|is blocked|unaddressed abuse') + local isOK=$(echo "$tmpresult" | grep -i 'curl') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r Google Search CAPTCHA Free:\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r Google Search CAPTCHA Free:\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r Google Search CAPTCHA Free:\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Google Search CAPTCHA Free:\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_BritBox() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.britbox.com/' -w '%{http_code}_TAG_%{url_effective}\n' -o dev/null --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r BritBox:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local result=$(echo "$urlEffective" | grep -E 'locationnotsupported|locationnotvalidated|britbox.co.uk') + + if [ -n "$result" ]; then + echo -n -e "\r BritBox:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + echo -n -e "\r BritBox:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r BritBox:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_PrimeVideo() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Amazon Prime Video:\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://www.primevideo.com' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Amazon Prime Video:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -i 'isServiceRestricted') + local region=$(echo "$tmpresult" | grep -woP '"currentTerritory":"\K[^"]+' | head -n 1) + + if [ -z "$isBlocked" ] && [ -z "$region" ]; then + echo -n -e "\r Amazon Prime Video:\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r Amazon Prime Video:\t\t\t${Font_Red}No (Service Not Available)${Font_Suffix}\n" + return + fi + if [ -n "$region" ]; then + echo -n -e "\r Amazon Prime Video:\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r Amazon Prime Video:\t\t\t${Font_Red}Failed (Error: Unknown Region)${Font_Suffix}\n" +} + +function MediaUnlockTest_Radiko() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Radiko:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://radiko.jp/area?_=1625406539531' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Radiko:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep 'class="OUT"') + local isOK=$(echo "$tmpresult" | grep -i 'JAPAN') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r Radiko:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r Radiko:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + local area=$(echo "$tmpresult" | awk '{print $2}' | sed 's/.*>//') + echo -n -e "\r Radiko:\t\t\t\t${Font_Green}Yes (City: $area)${Font_Suffix}\n" + return + fi + + echo -n -e "\r Radiko:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_DMM() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r DMM:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://bitcoin.dmm.com/' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r DMM:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep 'This page is not available in your area') + local isOK=$(echo "$tmpresult" | grep '暗号資産') + + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r DMM:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r DMM:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r DMM:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r DMM:\t\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_DMMTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r DMM TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.beacon.dmm.com/v1/streaming/start' -X POST -d '{"player_name":"dmmtv_browser","player_version":"0.0.0","content_type_detail":"VOD_SVOD","content_id":"11uvjcm4fw2wdu7drtd1epnvz","purchase_product_id":null}' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r DMM TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep 'FOREIGN') + local isOK=$(echo "$tmpresult" | grep 'UNAUTHORIZED') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r DMM TV:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r DMM TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r DMM TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r DMM TV:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_Catchplay() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r CatchPlay+:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://sunapi.catchplay.com/geo' -H "authorization: Basic NTQ3MzM0NDgtYTU3Yi00MjU2LWE4MTEtMzdlYzNkNjJmM2E0Ok90QzR3elJRR2hLQ01sSDc2VEoy" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r CatchPlay+:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$result" ]; then + echo -n -e "\r CatchPlay+:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + case "$result" in + '0') echo -n -e "\r CatchPlay+:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '100016') echo -n -e "\r CatchPlay+:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Now E:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_HotStar() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sLi 'https://www.hotstar.com' -w '\n_TAG_%{http_code}_TAG_%{url_effective}_TAG_\n' --user-agent "${UA_BROWSER}") + + local httpCode=$(echo "$tmpresult" | grep -o '_TAG_.*_TAG_' | awk -F'_TAG_' '{print $2}') + + if [ "$httpCode" == '000' ]; then + echo -n -e "\r HotStar:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '403' ]; then + echo -n -e "\r HotStar:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '475' ]; then + echo -n -e "\r HotStar:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | grep -o '_TAG_.*_TAG_' | awk -F'_TAG_' '{print $3}') + local region=$(echo "$tmpresult" | grep -woP 'geo=\K[A-Z]+' | head -n 1) + local siteRegion=$(echo "$urlEffective" | sed 's@.*com/@@' | tr a-z A-Z) + + if [ -z "$region" ]; then + echo -n -e "\r HotStar:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ "$region" == 'US' ]; then + echo -n -e "\r HotStar:\t\t\t\t${Font_Yellow}No (Discontinued in the US)${Font_Suffix}\n" + return + fi + if [ "$region" == "$siteRegion" ]; then + echo -n -e "\r HotStar:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r HotStar:\t\t\t\t${Font_Red}Failed (Error: REGION ERROR ${region}_${siteRegion})${Font_Suffix}\n" +} + +function MediaUnlockTest_LiTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r LiTV:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local fakePUid=$(gen_uuid) + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://www.litv.tv/api/get-urls-no-auth' -H 'accept: application/json, text/plain, */*' -H 'content-type: application/json' -H 'accept-language: en-US,en;q=0.9' -H 'origin: https://www.litv.tv' -H 'referer: https://www.litv.tv/drama/watch/VOD00328856' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-origin' --data-raw "{\"AssetId\":\"vod70810-000001M001_1500K\",\"MediaType\":\"vod\",\"puid\":\"${fakePUid}\"}" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r LiTV:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isOK=$(echo "$tmpresult" | grep 'AssetURLs') + local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}\K[^"][0-9]{0,}') + + if [ -n "$isOK" ]; then + echo -n -e "\r LiTV:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + case "$result" in + '42000087') echo -n -e "\r LiTV:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '42000075') echo -n -e "\r LiTV:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; # 剧集不存在 + '') echo -n -e "\r LiTV:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" ;; + *) echo -n -e "\r LiTV:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_FuboTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Fubo TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fs "https://api.fubo.tv/v3/location" -H 'accept: */*' -H 'accept-language: en-US,en;q=0.9' -H 'origin: https://www.fubo.tv' -H 'referer: https://www.fubo.tv/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Fubo TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local noService=$(echo "$tmpresult" | grep -i 'NO_SERVICE_IN_COUNTRY') + local isAllowed=$(echo "$tmpresult" | grep -o '"network_allowed":true') + local isBlocked=$(echo "$tmpresult" | grep -o '"network_allowed":false') + local countryCode=$(echo "$tmpresult" | grep -oP '"country_code2":"\K[^"]+') + + if [ -n "$noService" ]; then + echo -n -e "\r Fubo TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r Fubo TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isAllowed" ]; then + echo -n -e "\r Fubo TV:\t\t\t\t${Font_Green}Yes (Region:${countryCode})${Font_Suffix}\n" + return + fi + + echo -n -e "\r Fubo TV:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_Fox() { + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://x-live-fox-stgec.uplynk.com/ausw/slices/8d1/d8e6eec26bf544f084bad49a7fa2eac5/8d1de292bcc943a6b886d029e6c0dc87/G00000000.ts?pbs=c61e60ee63ce43359679fb9f65d21564&cloud=aws&si=0' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r FOX:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r FOX:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r FOX:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r FOX:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_Joyn() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Joyn:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpauth=$(curl ${CURL_DEFAULT_OPTS} -s 'https://auth.joyn.de/auth/anonymous' -X POST -H "Content-Type: application/json" -d '{"client_id":"b74b9f27-a994-4c45-b7eb-5b81b1c856e7","client_name":"web","anon_device_id":"b74b9f27-a994-4c45-b7eb-5b81b1c856e7"}' --user-agent "${UA_BROWSER}") + if [ -z "$tmpauth" ]; then + echo -n -e "\r Joyn:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local auth=$(echo "$tmpauth" | grep -woP '"access_token"\s{0,}:\s{0,}"\K[^"]+') + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.joyn.de/content/entitlement-token' -H "x-api-key: 36lp1t4wto5uu2i2nk57ywy9on1ns5yg" -H "content-type: application/json" -d '{"content_id":"daserste-de-hd","content_type":"LIVE"}' -H "authorization: Bearer ${auth}" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Joyn:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + local isOK=$(echo "$tmpresult" | grep -i 'entitlement_token') + local isBlocked=$(echo "$tmpresult" | grep -i 'ENT_AssetNotAvailableInCountry') + + if [ -z "$isOK" ] && [ -z "$isBlocked" ]; then + echo -n -e "\r Joyn:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r Joyn:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r Joyn:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Joyn:\t\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_SpotvNow() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r SPOTV NOW:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://edge.api.brightcove.com/playback/v1/accounts/5764318566001/videos/6349973203112' -H 'accept: application/json;pk=BCpkADawqM0U3mi_PT566m5lvtapzMq3Uy7ICGGjGB6v4Ske7ZX_ynzj8ePedQJhH36nym_5mbvSYeyyHOOdUsZovyg2XlhV6rRspyYPw_USVNLaR0fB_AAL2HSQlfuetIPiEzbUs1tpNF9NtQxt3BAPvXdOAsvy1ltLPWMVzJHiw9slpLRgI2NUufc' -H 'accept-language: en-US,en;q=0.9' -H 'origin: https://www.spotvnow.co.kr' -H 'referer: https://www.spotvnow.co.kr/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: cross-site' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r SPOTV NOW:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"error_subcode"\s{0,}:\s{0,}"\K[^"]+') + + case "$result" in + 'CLIENT_GEO') echo -n -e "\r SPOTV NOW:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '') echo -n -e "\r SPOTV NOW:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r SPOTV NOW:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_SKY_DE() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r SKY DE:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://edge.api.brightcove.com/playback/v1/accounts/1050888051001/videos/6247131490001' -H "Accept: application/json;pk=BCpkADawqM0OXCLe4eIkpyuir8Ssf3kIQAM62a1KMa4-1_vTOWQIxoHHD4-oL-dPmlp-rLoS-WIAcaAMKuZVMR57QY4uLAmP4Ov3V416hHbqr0GNNtzVXamJ6d4-rA3Xi98W-8wtypdEyjGEZNepUCt3D7UdMthbsG-Ean3V4cafT4nZX03st5HlyK1chp51SfA-vKcAOhHZ4_Oa9TTN61tEH6YqML9PWGyKrbuN5myICcGsFzP3R2aOF8c5rPCHT2ZAiG7MoavHx8WMjhfB0QdBr2fphX24CSpUKlcjEnQJnBiA1AdLg9iyReWrAdQylX4Eyhw5OwKiCGJznfgY6BDtbUmeq1I9r9RfmhP5bfxVGjILSEFZgXbMqGOvYdrdare0aW2fTCxeHdHt0vyKOWTC6CS1lrGJF2sFPKn1T1csjVR8s4MODqCBY1PTbHY4A9aZ-2MDJUVJDkOK52hGej6aXE5b9N9_xOT2B9wbXL1B1ZB4JLjeAdBuVtaUOJ44N0aCd8Ns0o02E1APxucQqrjnEociLFNB0Bobe1nkGt3PS74IQcs-eBvWYSpolldMH6TKLu8JqgdnM4WIp3FZtTWJRADgAmvF9tVDUG9pcJoRx_CZ4im-rn-AzN3FeOQrM4rTlU3Q8YhSmyEIoxYYqsFDwbFlhsAcvqQkgaElYtuciCL5i3U8N4W9rIhPhQJzsPafmLdWxBP_FXicyek25GHFdQzCiT8nf1o860Jv2cHQ4xUNcnP-9blIkLy9JmuB2RgUXOHzWsrLGGW6hq9wLUtqwEoxcEAAcNJgmoC0k8HE-Ga-NHXng6EFWnqiOg_mZ_MDd7gmHrrKLkQV" -H "Origin: https://www.sky.de" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r SKY DE:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"error_subcode"\s{0,}:\s{0,}"\K[^"]+') + + case "$result" in + 'CLIENT_GEO') echo -n -e "\r SKY DE:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '') echo -n -e "\r SKY DE:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r SKY DE:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_ZDF() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r ZDF: \t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://ssl.zdf.de/geo/de/geo.txt/' -w %{http_code} -o /dev/null --user-agent "${UA_ANDROID}") + + case "$result" in + '000') echo -n -e "\r ZDF: \t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '404') echo -n -e "\r ZDF: \t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r ZDF: \t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r ZDF: \t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_HBOGO_ASIA() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r HBO GO Asia:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api2.hbogoasia.com/v1/geog?lang=undefined&version=0&bundleId=www.hbogoasia.com' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r HBO GO Asia:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"territory"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$result" ]; then + echo -n -e "\r HBO GO Asia:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + local region=$(echo "$tmpresult" | grep -woP '"country"\s{0,}:\s{0,}"\K[^"]+') + if [ -n "$region" ]; then + echo -n -e "\r HBO GO Asia:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r HBO GO Asia:\t\t\t\t${Font_Red}Failed (Error: Country Code Not Found)${Font_Suffix}\n" +} + +function MediaUnlockTest_EPIX() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r MGM+:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpToken=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.epix.com/v2/sessions' -X POST -H 'host: api.epix.com' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'traceparent: 00-000000000000000015b7efdb572b7bf2-4aefaea90903bd1f-01' -H 'sec-ch-ua-mobile: ?0' -H 'x-datadog-origin: rum' -H 'x-datadog-sampling-priority: 1' -H 'accept: application/json' -H 'x-datadog-trace-id: 1564983120873880562' -H 'x-datadog-parent-id: 5399726519264460063' -H 'sec-ch-ua-platform: "Windows"' -H 'origin: https://www.mgmplus.com' -H 'sec-fetch-site: cross-site' -H 'sec-fetch-mode: cors' -H 'sec-fetch-dest: empty' -H 'referer: https://www.mgmplus.com/' -H 'accept-language: en-US,en;q=0.9' -H 'content-type: application/json' -d '{"device":{"guid":"7a0baaaf-384c-45cd-a21d-310ca5d3002a","format":"console","os":"web","display_width":1865,"display_height":942,"app_version":"1.0.2","model":"browser","manufacturer":"google"},"apikey":"53e208a9bbaee479903f43b39d7301f7"}' --user-agent "${UA_BROWSER}") + if [ -z "$tmpToken" ]; then + echo -n -e "\r MGM+:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local is403=$(echo "$tmpToken" | grep -i '403 ERROR') + if [ -n "$is403" ]; then + echo -n -e "\r MGM+:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + local epixToken=$(echo "$tmpToken" | grep -woP '"session_token"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$epixToken" ]; then + echo -n -e "\r MGM+:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.epix.com/graphql' -X POST -H 'host: api.epix.com' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'traceparent: 00-0000000000000000603047c112148412-32d64f8c890631ef-01' -H 'sec-ch-ua-mobile: ?0' -H 'x-datadog-origin: rum' -H 'x-datadog-sampling-priority: 1' -H 'accept: application/json' -H "x-session-token: ${epixToken}" -H 'x-datadog-trace-id: 6931118721080787986' -H 'x-datadog-parent-id: 3663202811925377519' -H 'sec-ch-ua-platform: "Windows"' -H 'origin: https://www.mgmplus.com' -H 'sec-fetch-site: cross-site' -H 'sec-fetch-mode: cors' -H 'sec-fetch-dest: empty' -H 'referer: https://www.mgmplus.com/' -H 'accept-language: en-US,en;q=0.9' -H 'content-type: application/json' -d '{"operationName":"PlayFlow","variables":{"id":"c2VyaWVzOzEwMTc=","supportedActions":["open_url","show_notice","start_billing","play_content","log_in","noop","confirm_provider","unlinked_provider"],"streamTypes":[{"encryptionScheme":"CBCS","packagingSystem":"DASH"},{"encryptionScheme":"CENC","packagingSystem":"DASH"},{"encryptionScheme":"NONE","packagingSystem":"HLS"},{"encryptionScheme":"SAMPLE_AES","packagingSystem":"HLS"}]},"query":"fragment ShowNotice on ShowNotice {\n type\n actions {\n continuationContext\n text\n __typename\n }\n description\n title\n __typename\n}\n\nfragment OpenUrl on OpenUrl {\n type\n url\n __typename\n}\n\nfragment Content on Content {\n title\n __typename\n}\n\nfragment Movie on Movie {\n id\n shortName\n __typename\n}\n\nfragment Episode on Episode {\n id\n series {\n shortName\n __typename\n }\n seasonNumber\n number\n __typename\n}\n\nfragment Preroll on Preroll {\n id\n __typename\n}\n\nfragment ContentUnion on ContentUnion {\n ...Content\n ...Movie\n ...Episode\n ...Preroll\n __typename\n}\n\nfragment PlayContent on PlayContent {\n type\n continuationContext\n heartbeatToken\n currentItem {\n content {\n ...ContentUnion\n __typename\n }\n __typename\n }\n nextItem {\n content {\n ...ContentUnion\n __typename\n }\n showNotice {\n ...ShowNotice\n __typename\n }\n showNoticeAt\n __typename\n }\n amazonPlaybackData {\n pid\n playbackToken\n materialType\n __typename\n }\n playheadPosition\n vizbeeStreamInfo {\n customStreamInfo\n __typename\n }\n closedCaptions {\n ttml {\n location\n __typename\n }\n vtt {\n location\n __typename\n }\n xml {\n location\n __typename\n }\n __typename\n }\n hints {\n duration\n seekAllowed\n trackingEnabled\n trackingId\n __typename\n }\n streams(types: $streamTypes) {\n playlistUrl\n closedCaptionsEmbedded\n packagingSystem\n encryptionScheme\n videoQuality {\n height\n width\n __typename\n }\n widevine {\n authenticationToken\n licenseServerUrl\n __typename\n }\n playready {\n authenticationToken\n licenseServerUrl\n __typename\n }\n fairplay {\n authenticationToken\n certificateUrl\n licenseServerUrl\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment StartBilling on StartBilling {\n type\n __typename\n}\n\nfragment LogIn on LogIn {\n type\n __typename\n}\n\nfragment Noop on Noop {\n type\n __typename\n}\n\nfragment PreviewContent on PreviewContent {\n type\n title\n description\n stream {\n sources {\n hls {\n location\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment ConfirmProvider on ConfirmProvider {\n type\n __typename\n}\n\nfragment UnlinkedProvider on UnlinkedProvider {\n type\n __typename\n}\n\nquery PlayFlow($id: String!, $supportedActions: [PlayFlowActionEnum!]!, $context: String, $behavior: BehaviorEnum = DEFAULT, $streamTypes: [StreamDefinition!]) {\n playFlow(\n id: $id\n supportedActions: $supportedActions\n context: $context\n behavior: $behavior\n ) {\n ...ShowNotice\n ...OpenUrl\n ...PlayContent\n ...StartBilling\n ...LogIn\n ...Noop\n ...PreviewContent\n ...ConfirmProvider\n ...UnlinkedProvider\n __typename\n }\n}"}' --user-agent "${UA_BROWSER}") + + local isBlocked=$(echo "$tmpresult" | grep -i 'MGM+ is only available in the United States') + local isOK=$(echo "$tmpresult" | grep -i 'StartBilling') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r MGM+:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r MGM+:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r MGM+:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r MGM+:\t\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_NLZIET() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r NLZIET:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.nlziet.nl/v7/stream/handshake/Widevine/Dash/VOD/rzIL9rb-TkSn-ek_wBmvaw?playerName=BitmovinWeb' -H 'accept: application/json, text/plain, */*' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkM4M0YzQUFGOTRCOTM0ODA2NkQwRjZDRTNEODhGQkREIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE3MTIxMjY0NTMsImV4cCI6MTcxMjE1NTI0OCwiaXNzIjoiaHR0cHM6Ly9pZC5ubHppZXQubmwiLCJhdWQiOiJhcGkiLCJjbGllbnRfaWQiOiJ0cmlwbGUtd2ViIiwic3ViIjoiMDAzMTZiNGEtMDAwMC0wMDAwLWNhZmUtZjFkZTA1ZGVlZmVlIiwiYXV0aF90aW1lIjoxNzEyMTI2NDUzLCJpZHAiOiJsb2NhbCIsImVtYWlsIjoibXVsdGkuZG5zMUBvdXRsb29rLmNvbSIsInVzZXJJZCI6IjMyMzg3MzAiLCJjdXN0b21lcklkIjoiMCIsImRldmljZUlkZW50aWZpZXIiOiJJZGVudGl6aWV0LTI0NWJiNmYzLWM2ZjktNDNjZS05ODhmLTgxNDc2OTcwM2E5OCIsImV4dGVybmFsVXNlcklkIjoiZTM1ZjdkMzktMjQ0ZC00ZTkzLWFkOTItNGFjYzVjNGY0NGNlIiwicHJvZmlsZUlkIjoiMjdDMzM3RjktOTRDRS00NjBDLTlBNjktMTlDNjlCRTYwQUIzIiwicHJvZmlsZUNvbG9yIjoiRkY0MjdDIiwicHJvZmlsZVR5cGUiOiJBZHVsdCIsIm5hbWUiOiJTdHJlYW1pbmciLCJqdGkiOiI4Q0M1QzYzNkJGRjg3MEE2REJBOERBNUMwQTk0RUZDRiIsImlhdCI6MTcxMjEyNjQ1Mywic2NvcGUiOlsiYXBpIiwib3BlbmlkIl0sImFtciI6WyJwcm9maWxlIiwicHdkIl19.bk-ziFPJM00bpE7TcgPmIYFFx-2Q5N3BkUzEvQ_dDMK9O1F9f7DEe-Qzmnb5ym7ChlnXwrCV3QyOOA24hu_gCrlNlD7-vI3XGZR-54zFD-F7cRDOoL-1-iO_10tmgwb5Io-svY0bn0EDYKeRxYYBi0w_3bFVFDM2CxxA6tWeBYIfN5rCSzBHd3RPPjYtqX-sogyh_5W_7KJ83GK5kpsywT3mz8q7Cs1mtKs9QA1-o01N0RvTxZAcfzsHg3-qGgLnvaAuZ_XqRK9kLWqJWeJTWKWtUI6OlPex22sY3keKFpfZnUtFv-BvkCM6tvbIlMZAClk3lhI8rMFAWDpUcbcS3w' -H 'nlziet-appname: WebApp' -H 'nlziet-appversion: 5.43.24' -H 'origin: https://app.nlziet.nl' -H 'referer: https://app.nlziet.nl/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r NLZIET:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -i 'CountryNotAllowed') + local isOK=$(echo "$tmpresult" | grep -i 'streamSessionId') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r NLZIET:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r NLZIET:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r NLZIET:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r NLZIET:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_videoland() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.videoland.com/subscribe/videoland-account/graphql' -X POST -H 'host: api.videoland.com' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'apollographql-client-name: apollo_accounts_base' -H 'traceparent: 00-cab2dbd109bf1e003903ec43eb4c067d-623ef8e56174b85a-01' -H 'sec-ch-ua-mobile: ?0' -H 'accept: */*' -H 'sec-ch-ua-platform: "Windows"' -H 'origin: https://www.videoland.com' -H 'sec-fetch-site: same-site' -H 'sec-fetch-mode: cors' -H 'sec-fetch-dest: empty' -H 'referer: https://www.videoland.com/' -H 'accept-language: en-US,en;q=0.9' -H 'content-type: application/json' -d '{"operationName":"IsOnboardingGeoBlocked","variables":{},"query":"query IsOnboardingGeoBlocked {\n isOnboardingGeoBlocked\n}\n"}' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r videoland:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"isOnboardingGeoBlocked"\s{0,}:\s{0,}\K(false|true)') + case "$result" in + 'false') echo -n -e "\r videoland:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + 'true') echo -n -e "\r videoland:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '') echo -n -e "\r videoland:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" ;; + *) echo -n -e "\r videoland:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_NPO_Start_Plus() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://www.npo.nl/start/api/domain/player-token?productId=LI_NL1_4188102' -H 'host: www.npo.nl' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'accept: application/json, text/plain, */*' -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-site: same-origin' -H 'sec-fetch-mode: cors' -H 'sec-fetch-dest: empty' -H 'referer: https://www.npo.nl/start/live?channel=NPO1' -H 'accept-language: en-US,en;q=0.9' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r NPO Start Plus:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local token=$(echo "$tmpresult" | grep -woP '"token"\s{0,}:\s{0,}"\K[^"]+') + local result=$(curl ${CURL_DEFAULT_OPTS} -s 'https://prod.npoplayer.nl/stream-link' -w %{http_code} -o /dev/null -H 'accept: */*' -H "authorization: ${token}" -H 'content-type: application/json' -H 'origin: https://npo.nl' -H 'referer: https://npo.nl/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: cross-site' --data-raw '{"profileName":"dash","drmType":"playready","referrerUrl":"https://npo.nl/start/live?channel=NPO1"}' -H 'accept-language: en-US,en;q=0.9' --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r NPO Start Plus:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r NPO Start Plus:\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '451') echo -n -e "\r NPO Start Plus:\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r NPO Start Plus:\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_RakutenTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Rakuten TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local fakeUuid=$(gen_uuid) + local fakeIfaId=$(gen_uuid) + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://gizmo.rakuten.tv/v3/me/start?device_identifier=web&device_stream_audio_quality=2.0&device_stream_hdr_type=NONE&device_stream_video_quality=FHD' -H 'accept: application/json, text/plain, */*' -H 'accept-language: en-US,en;q=0.9' -H 'content-type: application/json' -H 'origin: https://www.rakuten.tv' -H 'referer: https://www.rakuten.tv/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' --data-raw '{"device_identifier":"web","device_metadata":{"app_version":"v5.5.30","audio_quality":"2.0","brand":"chrome","firmware":"XX.XX.XX","hdr":false,"model":"GENERIC","os":"Windows 10","sdk":"125.0.0","serial_number":"not implemented","trusted_uid":false,"uid":"824b3fe9-e080-4c33-912b-3f67d96f5f99","video_quality":"FHD","year":1970},"ifa_id":"4ac8a156-b857-4335-96c1-fa8930430092"}' --user-agent "${UA_BROWSER}") + + if [ -z "$tmpresult" ]; then + echo -n -e "\r Rakuten TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -iE 'VPN|forbidden|is not available') + if [ -n "$isBlocked" ]; then + echo -n -e "\r Rakuten TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + local region=$(echo "$tmpresult" | grep -woP '"iso3166_code"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$region" ]; then + echo -n -e "\r Rakuten TV:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + local isOK=$(echo "$tmpresult" | grep -i 'streaming_drm_types') + if [ -n "$isOK" ]; then + echo -n -e "\r Rakuten TV:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r Rakuten TV:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_MoviStarPlus() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Movistar+:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -s 'https://contratar.movistarplus.es/' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r Movistar+:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r Movistar+:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r Movistar+:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Movistar+:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_Starz() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Starz:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local authorization=$(curl ${CURL_DEFAULT_OPTS} -s 'https://www.starz.com/sapi/header/v1/starz/us/09b397fc9eb64d5080687fc8a218775b' -H "Referer: https://www.starz.com/us/en/" --user-agent "${UA_BROWSER}") + if [ -z "$authorization" ]; then + echo -n -e "\r Starz:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://auth.starz.com/api/v4/User/geolocation' -H "AuthTokenAuthorization: $authorization") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Starz:\t\t\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + + local isAllowedAccess=$(echo "$tmpresult" | grep -woP '"isAllowedAccess"\s{0,}:\s{0,}\K(false|true)') + local isAllowedCountry=$(echo "$tmpresult" | grep -woP '"isAllowedCountry"\s{0,}:\s{0,}\K(false|true)') + local isKnownProxy=$(echo "$tmpresult" | grep -woP '"isKnownProxy"\s{0,}:\s{0,}\K(false|true)') + + if [ -z "$isAllowedAccess" ] || [ -z "$isAllowedCountry" ] || [ -z "$isKnownProxy" ]; then + echo -n -e "\r Starz:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ "$isAllowedAccess" == 'true' ] && [ "$isAllowedCountry" == 'true' ] && [ "$isKnownProxy" == 'false' ]; then + echo -n -e "\r Starz:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + if [ "$isAllowedAccess" == 'false' ]; then + echo -n -e "\r Starz:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$isKnownProxy" == 'false' ]; then + echo -n -e "\r Starz:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + echo -n -e "\r Starz:\t\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_CanalPlus() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Canal+:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://boutique-tunnel.canalplus.com/' -w '%{http_code}_TAG_%{url_effective}\n' -o dev/null --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Canal+:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local result=$(echo "$urlEffective" | grep -i 'other-country-blocking') + if [ -n "$result" ]; then + echo -n -e "\r Canal+:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + echo -n -e "\r Canal+:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Canal+:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_Sky_CH() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://sky.ch/' -w '%{http_code}_TAG_%{url_effective}\n' -o /dev/null --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r SKY CH:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + if [ "$httpCode" == '403' ]; then + echo -n -e "\r SKY CH:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local result=$(echo "$urlEffective" | grep -i 'out-of-country') + if [ -n "$result" ]; then + echo -n -e "\r SKY CH:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + if [ "$httpCode" == '200' ]; then + echo -n -e "\r SKY CH:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r SKY CH:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_CBCGem() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r CBC Gem:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://www.cbc.ca/g/stats/js/cbc-stats-top.js' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r CBC Gem:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"country"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "${result}" ]; then + echo -n -e "\r CBC Gem:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ "$result" == 'CA' ]; then + echo -n -e "\r CBC Gem:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r CBC Gem:\t\t\t\t${Font_Red}No${Font_Suffix}\n" +} + +function MediaUnlockTest_AcornTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Acorn TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://acorn.tv/' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Acorn TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -iE 'not yet available in your|unavailable in your') + local isOK=$(echo "$tmpresult" | grep -i 'signup.acorn.tv') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r Acorn TV:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r Acorn TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r Acorn TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Acorn TV:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_Crave() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Crave:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://capi.9c9media.com/destinations/crave_atexace/platforms/desktop/playback/contents/2917721/contentPackages/6642701/manifest.mpd?action=reference&ssl=true&filter=fe&mca=false&uhd=false&mcv=false&hd=true&tpt=true&mta=true&stt=true&multilang=true' -H 'Content-Type: application/json' -H 'Origin: https://www.crave.ca' -H 'Referer: https://www.crave.ca/' -H 'accept-language: en-US,en;q=0.9' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Crave:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isOK=$(echo "$tmpresult" | grep -i 'video.9c9media.com') + local isBlocked=$(echo "$tmpresult" | grep -i 'Geo Constraint Restrictions') + + if [ -z "$isOK" ] && [ -z "$isBlocked" ]; then + echo -n -e "\r Crave:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r Crave:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r Crave:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Crave:\t\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_Amediateka() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Amediateka:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.amediateka.ru/' -w '%{http_code}_TAG_%{url_effective}\n' -o /dev/null --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Amediateka:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local result=$(echo "$urlEffective" | grep -i 'unavailable') + if [ -n "$result" ]; then + echo -n -e "\r Amediateka:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '503' ]; then + echo -n -e "\r Amediateka:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + echo -n -e "\r Amediateka:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Amediateka:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_MegogoTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Megogo TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://megogo.net/en' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Megogo TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local vpnDetected=$(echo "$tmpresult" | grep -i 'VPN') + if [ -n "$vpnDetected" ]; then + echo -n -e "\r Megogo TV:\t\t\t\t${Font_Red}No (VPN Detected)${Font_Suffix}\n" + return + fi + + echo -n -e "\r Megogo TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" +} + +function MediaUnlockTest_RaiPlay() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Rai Play:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://mediapolisvod.rai.it/relinker/relinkerServlet.htm?cont=VxXwi7UcqjApssSlashbjsAghviAeeqqEEqualeeqqEEqual&output=64' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Rai Play:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '\K[^<]+') + local isBlocked=$(echo "$tmpresult" | grep -i 'video_no_available') + + if [ -z "$result" ]; then + echo -n -e "\r Rai Play:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r Rai Play:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + case "$result" in + 'Y') echo -n -e "\r Rai Play:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + 'N') echo -n -e "\r Rai Play:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Rai Play:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_TVBAnywhere() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r TVBAnywhere+:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://uapisfm.tvbanywhere.com.sg/geoip/check/platform/android' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r TVBAnywhere+:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"allow_in_this_country"\s{0,}:\s{0,}\K(false|true)') + if [ -z "$result" ]; then + echo -n -e "\r TVBAnywhere+:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + case "$result" in + 'true') echo -n -e "\r TVBAnywhere+:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + 'false') echo -n -e "\r TVBAnywhere+:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r TVBAnywhere+:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" ;; + esac +} + +function GameTest_ProjectSekai() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Project Sekai: Colorful Stage:\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://game-version.sekai.colorfulpalette.org/1.8.1/3ed70b6a-8352-4532-b819-108837926ff5' -w %{http_code} -o /dev/null -H "User-Agent: pjsekai/48 CFNetwork/1240.0.4 Darwin/20.6.0") + + case "$result" in + '000') echo -n -e "\r Project Sekai: Colorful Stage:\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r Project Sekai: Colorful Stage:\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r Project Sekai: Colorful Stage:\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Project Sekai: Colorful Stage:\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function GameTest_KonosubaFD() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Konosuba Fantastic Days:\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://api.konosubafd.jp/api/masterlist' -X POST -w %{http_code} -o /dev/null -H "User-Agent: pj0007/212 CFNetwork/1240.0.4 Darwin/20.6.0") + + case "$result" in + '000') echo -n -e "\r Konosuba Fantastic Days:\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r Konosuba Fantastic Days:\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r Konosuba Fantastic Days:\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Konosuba Fantastic Days:\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_NBATV() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://www.nba.com/watch/' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r NBA TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -i 'Service is not available in your region') + + if [ -z "$result" ]; then + echo -n -e "\r NBA TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r NBA TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" +} + +function MediaUnlockTest_Directv() { + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://stream.directv.com/watchnow' -w %{http_code} -o /dev/null -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r Directv Stream:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r Directv Stream:\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r Directv Stream:\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Directv Stream:\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function RegionTest_NetflixCDN() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.fast.com/netflix/speedtest/v2?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=1' -w '_TAG_%{http_code}' --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | grep '_TAG_' | awk -F'_TAG_' '{print $2}') + local respContent=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Netflix Preferred CDN:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '403' ]; then + echo -n -e "\r Netflix Preferred CDN:\t\t\t${Font_Red}Failed (IP Banned By Netflix)${Font_Suffix}\n" + return + fi + + local cdnDomain=$(echo "$respContent" | grep -woP '"url":"\K[^"]+' | awk -F'[/:]' '{print $4}') + if [ -z "$cdnDomain" ]; then + echo -n -e "\r Netflix Preferred CDN:\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ "${USE_IPV6}" == 1 ]; then + local cdnIP=$(resolve_ip_address "$cdnDomain" 'AAAA') + else + local cdnIP=$(resolve_ip_address "$cdnDomain" 'A') + fi + + if [ -z "$cdnIP" ]; then + echo -n -e "\r Netflix Preferred CDN:\t\t\t${Font_Red}Failed (CDN IP Not Found)${Font_Suffix}\n" + return + fi + + if ! validate_intranet "$cdnIP"; then + local tmpresult1=$(curl ${CURL_DEFAULT_OPTS} -s "https://api.ip.sb/geoip/${cdnIP}" -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult1" ]; then + echo -n -e "\r Netflix Preferred CDN:\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + + local cdnISP=$(echo "$tmpresult1" | grep -woP '"isp"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$cdnISP" ]; then + echo -n -e "\r Netflix Preferred CDN:\t\t\t${Font_Red}Failed (Error: No ISP Info Found)${Font_Suffix}\n" + return + fi + else + cdnISP='Hidden by a VPN' + fi + + local iata=$(echo "$cdnDomain" | cut -f3 -d'-' | sed 's/.\{3\}$//' | tr a-z A-Z) + + # local IATACODE2=$(curl ${CURL_DEFAULT_OPTS} -s "https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/reference/IATACODE2.txt" 2>&1) + local isIataFound1=$(echo "$IATACODE" | grep -w "$iata") + local isIataFound2=$(echo "$IATACODE2" | grep -w "$iata") + + if [ -n "$isIataFound1" ]; then + local location=$(echo "$IATACODE" | grep -w "$iata" | awk -F'|' '{print $1}' | awk '{$1=$1; print}') + fi + if [ -z "$isIataFound1" ] && [ -n "$isIataFound2" ]; then + local location=$(echo "$IATACODE2" | grep -w "$iata" | awk -F',' '{print $2}' | awk '{$1=$1; print}' | tr A-Z a-z | sed 's/\b[a-z]/\U&/g') + fi + + if [ -z "$location" ]; then + echo -n -e "\r Netflix Preferred CDN:\t\t\t${Font_Red}Failed (Error: IATA CODE ERROR)${Font_Suffix}\n" + return + fi + + if [ "$cdnISP" == 'Netflix Streaming Services' ]; then + echo -n -e "\r Netflix Preferred CDN:\t\t\t${Font_Green}${location}${Font_Suffix}\n" + return + else + echo -n -e "\r Netflix Preferred CDN:\t\t\t${Font_Yellow}[${cdnISP}] in [${location}]${Font_Suffix}\n" + return + fi + + echo -n -e "\r Netflix Preferred CDN:\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_SkyGo() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Sky Go:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://skyid.sky.com/authorise/skygo?response_type=token&client_id=sky&appearance=compact&redirect_uri=skygo://auth' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Sky Go:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isSignIn=$(echo "$tmpresult" | grep -E "Sign in|skygoSignin") + if [ -n "$isSignIn" ]; then + echo -n -e "\r Sky Go:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -E "Access Denied.*You don't have permission to access") + if [ -n "$isBlocked" ]; then + echo -n -e "\r Sky Go:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + echo -n -e "\r Sky Go:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_DirecTVGO() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r DirecTV Go:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://www.directvgo.com/registrarse' -w '%{http_code}_TAG_%{url_effective}\n' -o /dev/null --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r DirecTV Go:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local isForbidden=$(echo "$urlEffective" | grep 'proximamente') + local region=$(echo "$urlEffective" | cut -f4 -d'/' | tr a-z A-Z) + + if [ -n "$isForbidden" ]; then + echo -n -e "\r DirecTV Go:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '403' ]; then + echo -n -e "\r DirecTV Go:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + echo -n -e "\r DirecTV Go:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r DirecTV Go:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_DAM() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Karaoke@DAM:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'http://cds1.clubdam.com/vhls-cds1/site/xbox/sample_1.mp4.m3u8' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r Karaoke@DAM:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r Karaoke@DAM:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r Karaoke@DAM:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Karaoke@DAM:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_DiscoveryPlus() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Discovery+:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + # 取得 API 网址 + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://global-prod.disco-api.com/bootstrapInfo' -H 'accept: */*' -H 'accept-language: en-US,en;q=0.9' -H 'origin: https://www.discoveryplus.com' -H 'referer: https://www.discoveryplus.com/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: cross-site' -H 'x-disco-client: WEB:UNKNOWN:dplus_us:2.46.0' -H 'x-disco-params: bid=dplus,hn=www.discoveryplus.com' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Discovery+:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local baseApiUrl=$(echo "$tmpresult" | grep -woP '"baseApiUrl"\s{0,}:\s{0,}"\K[^"]+') + local realm=$(echo "$tmpresult" | grep -woP '"realm"\s{0,}:\s{0,}"\K[^"]+') + + if [ -z "$baseApiUrl" ] || [ -z "$realm" ]; then + echo -n -e "\r Discovery+:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ "$realm" == 'dplusapac' ]; then + echo -n -e "\r Discovery+:\t\t\t\t${Font_Red}No (Not Yet Available in Asia Pacific)${Font_Suffix}\n" + return + fi + + local fakeDeviceId=$(gen_uuid | md5sum | cut -f1 -d' ') + + local tmpresult1=$(curl ${CURL_DEFAULT_OPTS} -s "${baseApiUrl}/token?deviceId=${fakeDeviceId}&realm=${realm}&shortlived=true" -H 'accept: */*' -H 'accept-language: en-US,en;q=0.9' -H 'origin: https://www.discoveryplus.com' -H 'referer: https://www.discoveryplus.com/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H "x-device-info: dplus_us/2.46.0 (desktop/desktop; Windows/NT 10.0; ${fakeDeviceId})" -H 'x-disco-client: WEB:UNKNOWN:dplus_us:2.46.0' -H "x-disco-params: realm=${realm},bid=dplus,hn=www.discoveryplus.com,hth=,features=ar" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult1" ]; then + echo -n -e "\r Discovery+:\t\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + + local token=$(echo "$tmpresult1" | grep -woP '"token"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$token" ]; then + echo -n -e "\r Discovery+:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR 1)${Font_Suffix}\n" + return + fi + + local tmpresult2=$(curl ${CURL_DEFAULT_OPTS} -s "${baseApiUrl}/cms/routes/tabbed-home?include=default&decorators=viewingHistory,isFavorite,playbackAllowed,contentAction" -H 'accept: */*' -H 'accept-language: en-US,en;q=0.9' -H 'origin: https://www.discoveryplus.com' -H 'referer: https://www.discoveryplus.com/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H 'x-disco-client: WEB:UNKNOWN:dplus_us:2.46.0' -H 'x-disco-params: realm=dplay,bid=dplus,hn=www.discoveryplus.com,hth=,features=ar' -b "st=${token}" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult2" ]; then + echo -n -e "\r Discovery+:\t\t\t\t${Font_Red}Failed (Network Connection 2)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult2" | grep -iE 'is unavailable in your|not yet available') + local isOK=$(echo "$tmpresult2" | grep -i 'relationships') + local region=$(echo "$tmpresult2" | grep -woP '"mainTerritoryCode"\s{0,}:\s{0,}"\K[^"]+' | tr a-z A-Z) + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r Discovery+:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR 2)${Font_Suffix}\n" + return + fi + + if [ -n "$isBlocked" ]; then + echo -n -e "\r Discovery+:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + if [ -n "$isOK" ]; then + echo -n -e "\r Discovery+:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r Discovery+:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_ESPNPlus() { + local espnCookies=$(echo "$MEDIA_COOKIE" | sed -n '11p') + local tokenContent=$(curl ${CURL_DEFAULT_OPTS} -s 'https://espn.api.edge.bamgrid.com/token' -X POST -H "authorization: Bearer ZXNwbiZicm93c2VyJjEuMC4w.ptUt7QxsteaRruuPmGZFaJByOoqKvDP2a5YkInHrc7c" -d "$espnCookies" --user-agent "${UA_BROWSER}") + if [ -z "$tokenContent" ]; then + echo -n -e "\r ESPN+:${Font_SkyBlue}[Sponsored by Jam]${Font_Suffix}\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tokenContent" | grep 'forbidden-location') + local is403=$(echo "$tokenContent" | grep '403 ERROR') + + if [ -n "$isBlocked" ] || [ -n "$is403" ]; then + echo -n -e "\r ESPN+:${Font_SkyBlue}[Sponsored by Jam]${Font_Suffix}\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + local fakeContent=$(echo "$MEDIA_COOKIE" | sed -n '10p') + local refreshToken=$(echo "$tokenContent" | grep -woP '"refresh_token"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$refreshToken" ]; then + echo -n -e "\r ESPN+:${Font_SkyBlue}[Sponsored by Jam]${Font_Suffix}\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + local espnContent=$(echo "$fakeContent" | sed "s/ILOVESTAR/${refreshToken}/g") + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://espn.api.edge.bamgrid.com/graph/v1/device/graphql' -X POST -H "authorization: ZXNwbiZicm93c2VyJjEuMC4w.ptUt7QxsteaRruuPmGZFaJByOoqKvDP2a5YkInHrc7c" -d "$espnContent" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r ESPN+:${Font_SkyBlue}[Sponsored by Jam]${Font_Suffix}\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local region=$(echo "$tmpresult" | grep -woP '"countryCode"\s{0,}:\s{0,}"\K[^"]+') + local inSupportedLocation=$(echo "$tmpresult" | grep -woP '"inSupportedLocation"\s{0,}:\s{0,}\K(false|true)') + + if [ -z "$region" ] || [ -z "$inSupportedLocation" ]; then + echo -n -e "\r ESPN+:${Font_SkyBlue}[Sponsored by Jam]${Font_Suffix}\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ "$region" == 'US' ] && [ "$inSupportedLocation" == 'true' ]; then + echo -n -e "\r ESPN+:${Font_SkyBlue}[Sponsored by Jam]${Font_Suffix}\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r ESPN+:${Font_SkyBlue}[Sponsored by Jam]${Font_Suffix}\t\t${Font_Red}No${Font_Suffix}\n" +} + +function MediaUnlockTest_Stan() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Stan:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.stan.com.au/login/v1/sessions/web/account' -X POST -w '_TAG_%{http_code}' --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | grep '_TAG_' | awk -F'_TAG_' '{print $2}') + local respContent=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Stan:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '403' ]; then + echo -n -e "\r Stan:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '411' ]; then + echo -n -e "\r Stan:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ -z "$respContent" ]; then + echo -n -e "\r Stan:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + local result=$(echo "$respContent" | grep -i 'VPNDetected') + if [ -z "$result" ]; then + echo -n -e "\r Stan:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Stan:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" +} + +function MediaUnlockTest_Binge() { + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://auth.streamotion.com.au' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r Binge:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r Binge:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r Binge:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Binge:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_Docplay() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Docplay:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.docplay.com/subscribe' -w '%{http_code}_TAG_%{url_effective}\n' -o /dev/null --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Docplay:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local isBlocked=$(echo "$urlEffective" | grep -i 'geoblocked') + + if [ -n "$isBlocked" ]; then + echo -n -e "\r Docplay:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '403' ]; then + echo -n -e "\r Docplay:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + echo -n -e "\r Docplay:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Docplay:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_OptusSports() { + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://sport.optus.com.au/api/userauth/validate/web/username/restriction.check@gmail.com' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r Optus Sports:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r Optus Sports:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r Optus Sports:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Optus Sports:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_KayoSports() { + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://billingapi.streamotion.com.au/v2/offers/kayo/' -H 'accept: */*' -H 'accept-language: en-US,en;q=0.9' -H 'origin: https://kayosports.com.au' -H 'referer: https://kayosports.com.au/' -H "sec-ch-ua: ${SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: cross-site' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r Kayo Sports:\t\t\t\t${Font_Red}Failed${Font_Suffix}\n" ;; + '200') echo -n -e "\r Kayo Sports:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r Kayo Sports:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Kayo Sports:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_NeonTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Neon TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local neonHeader=$(echo "$MEDIA_COOKIE" | sed -n '12p') + local neonContent=$(echo "$MEDIA_COOKIE" | sed -n '13p') + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.neontv.co.nz/api/client/gql?' -X POST -H "content-type: application/json" -H "$neonHeader" -d "$neonContent" -w '_TAG_%{http_code}' --user-agent "${UA_BROWSER}") + + local httpCode=$(echo "$tmpresult" | grep '_TAG_' | awk -F'_TAG_' '{print $2}') + local respContent=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Neon TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '403' ]; then + echo -n -e "\r Neon TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + if [ -z "$respContent" ]; then + echo -n -e "\r Neon TV:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + local result=$(echo "$respContent" | grep -i 'RESTRICTED_GEOLOCATION') + if [ -z "$result" ]; then + echo -n -e "\r Neon TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Neon TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" +} + +function MediaUnlockTest_SkyGONZ() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r SkyGo NZ:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://login.sky.co.nz/authorize?audience=https%3A%2F%2Fapi.sky.co.nz&client_id=dXhXjmK9G90mOX3B02R1kV7gsC4bp8yx&redirect_uri=https%3A%2F%2Fwww.skygo.co.nz&connection=Sky-Internal-Connection&scope=openid%20profile%20email%20offline_access&response_type=code&response_mode=query&state=OXg3QjBGTHpoczVvdG1fRnJFZXVoNDlPc01vNzZjWjZsT3VES2VhN1dDWA%3D%3D&nonce=OEdvci4xZHBHU3VLb1M0T1JRbTZ6WDZJVGQ3R3J0TTdpTndvWjNMZDM5ZA%3D%3D&code_challenge=My5fiXIl-cX79KOUe1yDFzA6o2EOGpJeb6w1_qeNkpI&code_challenge_method=S256&auth0Client=eyJuYW1lIjoiYXV0aDAtcmVhY3QiLCJ2ZXJzaW9uIjoiMS4zLjAifQ%3D%3D' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r SkyGo NZ:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r SkyGo NZ:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r SkyGo NZ:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r SkyGo NZ:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_ThreeNow() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r ThreeNow:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://bravo-livestream.fullscreen.nz/index.m3u8' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r ThreeNow:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r ThreeNow:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r ThreeNow:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r ThreeNow:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_MaoriTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Maori TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://www.maoriplus.co.nz/live-tv/whakaata-maori' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Maori TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + # 找出 index-*.js + local indexJsPath=$(echo "$tmpresult" | grep -woP 'src="\K/assets/index-[a-z0-9]{8}[^"]+') + if [ -z "$indexJsPath" ]; then + echo -n -e "\r Maori TV:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + # 下载 index-*.js + local tmpresult2=$(curl ${CURL_DEFAULT_OPTS} -s "https://www.maoriplus.co.nz${indexJsPath}" -H 'accept: */*' -H 'accept-language: en-US,en;q=0.9' -H 'origin: https://www.maoriplus.co.nz' -H 'referer: https://www.maoriplus.co.nz/live-tv/whakaata-maori' -H "sec-ch-ua: ${SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: script' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-origin' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult2" ]; then + echo -n -e "\r Maori TV:\t\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + # 取得 brightcove 播放器链接 + local playerJsUrl=$(echo "$tmpresult2" | grep -woP 'players.brightcove.net/[0-9]{13}/\w{9}_default/index.min.js') + local accountId=$(echo "$playerJsUrl" | grep -woP 'players.brightcove.net/\K[0-9]{13}') + if [ -z "$playerJsUrl" ]; then + echo -n -e "\r Maori TV:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + # 取得 brightcove 播放器信息 + local tmpresult3=$(curl ${CURL_DEFAULT_OPTS} -s "https://${playerJsUrl}" -H 'accept: */*' -H 'accept-language: en-US,en;q=0.9' -H 'referer: https://www.maoriplus.co.nz/' -H "sec-ch-ua: ${SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: script' -H 'sec-fetch-mode: no-cors' -H 'sec-fetch-site: cross-site' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult3" ]; then + echo -n -e "\r Maori TV:\t\t\t\t${Font_Red}Failed (Network Connection 2)${Font_Suffix}\n" + return + fi + + # 取 policy_key + local policyKey=$(echo "$tmpresult3" | grep -woP 'policyKey\s{0,}:\s{0,}"\KBCpk[^"]+') + + # 由于频道 ID 换的不是特别勤,直接固定,少几个请求 + # 该值从该 API 获取:https://api.one.accedo.tv/content/entries?typeAlias=live-channels + local bcChannelId='6278939271001' + # 最终检查 + local tmpresult4=$(curl ${CURL_DEFAULT_OPTS} -s "https://edge.api.brightcove.com/playback/v1/accounts/${accountId}/videos/${bcChannelId}" -H "accept: application/json;pk=${policyKey}" -H 'accept-language: en-US,en;q=0.9' -H 'origin: https://www.maoriplus.co.nz' -H 'referer: https://www.maoriplus.co.nz/' -H "sec-ch-ua: ${SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: cross-site' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult4" ]; then + echo -n -e "\r Maori TV:\t\t\t\t${Font_Red}Failed (Network Connection 3)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult4" | grep -woP '"error_subcode"\s{0,}:\s{0,}"\K[^"]+') + + case "$result" in + 'CLIENT_GEO') echo -n -e "\r Maori TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + 'SUCCESS') echo -n -e "\r Maori TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '') echo -n -e "\r Maori TV:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" ;; + *) echo -n -e "\r Maori TV:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_SBSonDemand() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r SBS on Demand:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://www.sbs.com.au/api/v3/network?context=odwebsite' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r SBS on Demand:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"country_code"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$result" ]; then + echo -n -e "\r SBS on Demand:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ "$result" == 'AU' ]; then + echo -n -e "\r SBS on Demand:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r SBS on Demand:\t\t\t\t${Font_Red}No${Font_Suffix}\n" +} + +function MediaUnlockTest_ABCiView() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r ABC iView:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.iview.abc.net.au/v2/show/abc-kids-live-stream/video/LS1604H001S00?embed=highlightVideo,selectedSeries' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r ABC iView:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -i 'unavailable outside Australia') + local isOK=$(echo "$tmpresult" | grep -woP '"playable"\s{0,}:\s{0,}\K(false|true)') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r ABC iView:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ -n "$isBlocked" ] ; then + echo -n -e "\r ABC iView:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + if [ "$isOK" == 'true' ]; then + echo -n -e "\r ABC iView:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r ABC iView:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_Channel9() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://login.nine.com.au' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Channel 9:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -i 'Geoblock') + local isOK=$(echo "$tmpresult" | grep -i 'Log in to') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r Channel 9:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r Channel 9:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r Channel 9:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Channel 9:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_Telasa() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api-videopass-anon.kddi-video.com/v1/playback/system_status' -H "X-Device-ID: d36f8e6b-e344-4f5e-9a55-90aeb3403799" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Telasa:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isForbidden=$(echo "$tmpresult" | grep -i 'IPLocationNotAllowed') + local isAllowed=$(echo "$tmpresult" | grep -woP '"type"\s{0,}:\s{0,}"\K[^"]+') + + if [ -z "$isAllowed" ] && [ -z "$isForbidden" ]; then + echo -n -e "\r Telasa:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isForbidden" ]; then + echo -n -e "\r Telasa:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$isAllowed" == 'OK' ]; then + echo -n -e "\r Telasa:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Telasa:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_SetantaSports() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Setanta Sports:\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://dce-frontoffice.imggaming.com/api/v2/consent-prompt' -H 'Realm: dce.adjara' -H 'x-api-key: 857a1e5d-e35e-4fdf-805b-a87b6f8364bf' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Setanta Sports:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"outsideAllowedTerritories"\s{0,}:\s{0,}\K(false|true)') + if [ -z "$result" ]; then + echo -n -e "\r Setanta Sports:\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ "$result" == 'true' ]; then + echo -n -e "\r Setanta Sports:\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$result" == 'false' ]; then + echo -n -e "\r Setanta Sports:\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Setanta Sports:\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_MolaTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Mola TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://mola.tv/api/v2/videos/geoguard/check/vd30491025' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Mola TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"isAllowed"\s{0,}:\s{0,}\K(false|true)') + if [ -z "$result" ]; then + echo -n -e "\r Mola TV:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ "$result" == 'true' ]; then + echo -n -e "\r Mola TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + if [ "$result" == 'false' ]; then + echo -n -e "\r Mola TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + echo -n -e "\r Mola TV:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_BeinConnect() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Bein Sports Connect:\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://proxies.bein-mena-production.eu-west-2.tuc.red/proxy/availableOffers' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r Bein Sports Connect:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '500') echo -n -e "\r Bein Sports Connect:\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '451') echo -n -e "\r Bein Sports Connect:\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r Bein Sports Connect:\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_EurosportRO() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Eurosport RO:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local fakeUuid=$(gen_uuid) + # 取得 Bearer 认证 token + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://eu3-prod-direct.eurosport.ro/token?realm=eurosport' -H 'accept: */*' -H 'accept-language: en-US,en;q=0.9' -H 'origin: https://www.eurosport.ro' -H 'referer: https://www.eurosport.ro/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H "x-device-info: escom/0.295.1 (unknown/unknown; Windows/10; ${fakeUuid})" -H 'x-disco-client: WEB:UNKNOWN:escom:0.295.1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Eurosport RO:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local token=$(echo "$tmpresult" | grep -woP '"token"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$token" ]; then + echo -n -e "\r Eurosport RO:\t\t\t\t${Font_Red}Failed (Error: PAGER ERROR)${Font_Suffix}\n" + return + fi + + # 随便选的视频 + local sourceSystemId='eurosport-vid2133403' + local tmpresult1=$(curl ${CURL_DEFAULT_OPTS} -s "https://eu3-prod-direct.eurosport.ro/playback/v2/videoPlaybackInfo/sourceSystemId/${sourceSystemId}?usePreAuth=true" -H "Authorization: Bearer ${token}" --user-agent "${UA_BROWSER}") + + local isBlocked=$(echo "$tmpresult1" | grep 'access.denied.geoblocked') + local isOK=$(echo "$tmpresult1" | grep 'eurosport-vod') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r Eurosport RO:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r Eurosport RO:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r Eurosport RO:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Eurosport RO:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_Channel5() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Channel 5:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local timestamp=$(date +%s) + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL "https://cassie.channel5.com/api/v2/live_media/my5desktopng/C5.json?timestamp=${timestamp}&auth=0_rZDiY0hp_TNcDyk2uD-Kl40HqDbXs7hOawxyqPnbI" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Channel 5:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}"\K[^"]+') + + case "$result" in + '3000') echo -n -e "\r Channel 5:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '4003') echo -n -e "\r Channel 5:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '') echo -n -e "\r Channel 5:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" ;; + *) echo -n -e "\r Channel 5:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_MyVideo() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r MyVideo:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.myvideo.net.tw/login.do' -w '%{http_code}_TAG_%{url_effective}\n' -o /dev/null --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + + if [ "$httpCode" == '000' ]; then + echo -n -e "\r MyVideo:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local isBlocked=$(echo "$urlEffective" | grep -i 'serviceAreaBlock') + + if [ -n "$isBlocked" ]; then + echo -n -e "\r MyVideo:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '403' ]; then + echo -n -e "\r MyVideo:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + echo -n -e "\r MyVideo:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r MyVideo:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_7plus() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r 7plus:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result1=$(curl ${CURL_DEFAULT_OPTS} -fsL "https://7plus-sevennetwork.akamaized.net/media/v1/dash/live/cenc/5303576322001/68dca38b-85d7-4dae-b1c5-c88acc58d51c/f4ea4711-514e-4cad-824f-e0c87db0a614/225ec0a0-ef18-4b7c-8fd6-8dcdd16cf03a/1x/segment0.m4f?akamai_token=exp=1672500385~acl=/media/v1/dash/live/cenc/5303576322001/68dca38b-85d7-4dae-b1c5-c88acc58d51c/f4ea4711-514e-4cad-824f-e0c87db0a614/*~hmac=800e1e1d1943addf12b71339277c637c7211582fe12d148e486ae40d6549dbde" -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + if [ "$result1" == '000' ]; then + echo -n -e "\r 7plus:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + if [ "$result1" == '200' ]; then + echo -n -e "\r 7plus:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + else + echo -n -e "\r 7plus:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi +} + +function MediaUnlockTest_Channel10() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Channel 10:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://e410fasadvz.global.ssl.fastly.net/geo' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Channel 10:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"allow"\s{0,}:\s{0,}\K(false|true)') + if [ -z "$result" ]; then + echo -n -e "\r Channel 10:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ "$result" == 'true' ]; then + echo -n -e "\r Channel 10:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + if [ "$result" == 'false' ]; then + echo -n -e "\r Channel 10:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + echo -n -e "\r Channel 10:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_Spotify() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://spclient.wg.spotify.com/signup/public/v1/account' -d "birth_day=11&birth_month=11&birth_year=2000&collect_personal_info=undefined&creation_flow=&creation_point=https%3A%2F%2Fwww.spotify.com%2Fhk-en%2F&displayname=Gay%20Lord&gender=male&iagree=1&key=a1e486e2729f46d6bb368d6b2bcda326&platform=www&referrer=&send-email=0&thirdpartyemail=0&identifier_token=AgE6YTvEzkReHNfJpO114514" -X POST -H "Accept-Language: en" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Spotify Registration:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local statusCode=$(echo "$tmpresult" | grep -woP '"status"\s{0,}:\s{0,}\K\d+') + local region=$(echo "$tmpresult" | grep -woP '"country"\s{0,}:\s{0,}"\K[^"]+') + local isLaunched=$(echo "$tmpresult" | grep -woP '"is_country_launched"\s{0,}:\s{0,}\K(false|true)') + + if [ -z "$statusCode" ]; then + echo -n -e "\r Spotify Registration:\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ "$statusCode" == '320' ] || [ "$statusCode" == '120' ]; then + echo -n -e "\r Spotify Registration:\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -z "$isLaunched" ] || [ -z "$region" ]; then + echo -n -e "\r Spotify Registration:\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ "$isLaunched" == 'false' ]; then + echo -n -e "\r Spotify Registration:\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$statusCode" == '311' ]; then + echo -n -e "\r Spotify Registration:\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r Spotify Registration:\t\t\t${Font_Red}Failed (Error: $statusCode)${Font_Suffix}\n" +} + +function MediaUnlockTest_VideoMarket() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r VideoMarket:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://www.videomarket.jp/graphql' -H 'authority: www.videomarket.jp' -H 'accept: */*' -H 'accept-language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6' -H 'authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjQ4MTkxNTkyMDIsImlhdCI6MTY2NTU1OTIwMiwiaXNzIjoiaHR0cHM6Ly9hdXRoLnZpZGVvbWFya2V0LmpwIiwic3ViIjoiY2ZjZDIwODQ5NWQ1NjVlZjY2ZTdkZmY5Zjk4NzY0ZGEiLCJ1c2VyX3R5cGUiOjAsInNpdGVfdHlwZSI6MiwiY2xpZW50X2lkIjoiYmVkNDdkOTFiMDVhYjgzMGM4YzBhYmFiYjQwNTg5MTFhY2E5NTdkMDBkMTUzNjA2MjI3NzNhOTQ0Y2RlNzRhNSIsInZtaWQiOjB9.Tq18RCxpVz1oV1lja52uRmF0nT6Oa0QsZMTVlPfANwb-RrcSn7PwE9vh7GdNIBc0ydDxRoUMuhStz_Kbu8KxvAh25eafFh7hf0DDqWKKU4ayPMueaR12t74SjFIRC7Cla1NR4uRn3_mgJfZFqOkIf6L5OR9LOVIBhrQPkhbMyqwZyh_kxTH7ToJIQoINb036ftqcF1KfR8ndtBlkrrWWnDpfkmE7-fJQHh92oKKd9l98W5awuEQo0MFspIdSNgt3gLi9t1RRKPDISGlzJkwMLPkHIUlWWZaAmnEkwSeZCPj_WJaqUqBATYKhi3yJZNGlHsScQ_KgAopxlsI6-c88Gps8i6yHvPVYw3hQ9XYq9gVL_SpyW9dKKSPE9MY6I19JHLBXuFXi5OJccqtQzTnKm_ZQM3EcKt5s0cNlXm9RMt0fNdRTQdJ53noD9o-b6hUIxDcHScJ_-30Emiv-55g5Sq9t5KPWO6o0Ggokkj42zin69MxCiUSHXk5FgeY8rX76yGBeLPLPIaaRPXEC1Jeo1VO56xNnQpyX_WHqHWDKhmOh1qSzaxiAiC5POMsTfwGr19TwXHUldYXxuNMIfeAaPZmNTzR5J6XdenFkLnrssVzXdThdlqHpfguLFvHnXTCAm0ZhFIJmacMNw1IxGmCQfkM4HtgKB9ZnWm6P0jIISdg' -H 'content-type: application/json' -H 'cookie: _gid=GA1.2.1853799793.1706147718; VM_REGIST_BANNER_REF_LINK=%2Ftitle%2F292072; __ulfpc=202401250957239984; _im_vid=01HMZ5C5GNNC6VWSPKD3E4W7YP; __td_signed=true; _td_global=0d11678b-5151-473e-b3a8-4f4d780f26a6; __juicer_sesid_9i3nsdfP_=d36a2e17-0117-47ce-95de-fbd5ffcda2d9; __juicer_session_referrer_9i3nsdfP_=d36a2e17-0117-47ce-95de-fbd5ffcda2d9___https%253A%252F%252Fwww.videomarket.jp%252Fplayer%252F292072%252FA292072001999H01; _gat_UA-221872486-2=1; _ga=GA1.2.777206008.1706147718; _ga_8HZQ9F8HV0=GS1.1.1706147717.1.1.1706147941.0.0.0; _td=3317738c-2329-4b61-ad5a-4e0ad230841d; dc_cl_id=ab38GzrmoV7muvtI' -H 'origin: https://www.videomarket.jp' -H 'referer: https://www.videomarket.jp/player/292072/A292072001999H01' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-origin' -H 'x-videomarket-requested: spa' --data-raw $'{"operationName":"repPacks","variables":{"repFullPackIds":["A292072001999H01"],"isOnSale":false,"isOnlyLatest":true},"query":"query repPacks($repFullPackIds: [String], $fullPacksIds: [String], $isOnSale: Boolean\u0021, $isOnlyLatest: Boolean\u0021) {\\n repPacks(\\n repFullPackIds: $repFullPackIds\\n fullPackIds: $fullPacksIds\\n onSale: $isOnSale\\n onlyLatest: $isOnlyLatest\\n ) {\\n repFullPackId\\n groupType\\n packName\\n fullTitleId\\n titleName\\n storyImageUrl16x9\\n playTime\\n subtitleDubType\\n outlines\\n courseIds\\n price\\n discountRate\\n couponPrice\\n couponDiscountRate\\n rentalDays\\n viewDays\\n deliveryExpiredAt\\n salesType\\n counter {\\n currentPage\\n currentResult\\n totalPages\\n totalResults\\n __typename\\n }\\n undiscountedPrice\\n packs {\\n undiscountedPrice\\n canPurchase\\n fullPackId\\n subGroupType\\n fullTitleId\\n qualityConsentType\\n courseIds\\n price\\n discountRate\\n couponPrice\\n couponDiscountRate\\n rentalDays\\n viewDays\\n deliveryExpiredAt\\n salesType\\n extId\\n stories {\\n fullStoryId\\n subtitleDubType\\n encodeVersion\\n isDownloadable\\n isBonusMaterial\\n fileSize\\n __typename\\n }\\n __typename\\n }\\n status {\\n hasBeenPlayed\\n isCourseRegistered\\n isEstPurchased\\n isNowPlaying\\n isPlayable\\n isRented\\n playExpiredAt\\n playableQualityType\\n rentalExpiredAt\\n __typename\\n }\\n __typename\\n }\\n}\\n"}' --user-agent "${UA_BROWSER}") + + if [ -z "$tmpresult" ]; then + echo -n -e "\r VideoMarket:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep 'OverseasAccess') + local isOK=$(echo "$tmpresult" | grep '292072') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r VideoMarket:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -n "$isBlocked" ]; then + echo -n -e "\r VideoMarket:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r VideoMarket:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r VideoMarket:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" +} + +function MediaUnlockTest_JCOM_ON_DEMAND() { + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://auth.id2.zaq.ne.jp/login' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r J:com On Demand:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r J:com On Demand:\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r J:com On Demand:\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r J:com On Demand:\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_musicjp() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r music.jp:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://overseaauth.music-book.jp/globalIpcheck.js' -w '_TAG_%{http_code}' --user-agent "${UA_BROWSER}") + + local httpCode=$(echo "$tmpresult" | grep '_TAG_' | awk -F'_TAG_' '{print $2}') + local respContent=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + local isOK=$(echo "$respContent" | grep -i 'checkIp') + + if [ "$httpCode" == '000' ]; then + echo -n -e "\r music.jp:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '403' ]; then + echo -n -e "\r music.jp:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -z "$respContent" ]; then + echo -n -e "\r music.jp:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r music.jp:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r music.jp:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" +} + +function MediaUnlockTest_InstagramMusic() { + ARCH=$(uname -m) + + if [ "$ARCH" = "x86_64" ]; then + curl -sL -o ./ins https://github.com/lmc999/RegionRestrictionCheck/raw/refs/heads/main/binary/ins_amd64 + chmod +x ./ins + clear + ./ins + elif [ "$ARCH" = "aarch64" ]; then + curl -sL -o ./ins https://github.com/lmc999/RegionRestrictionCheck/raw/refs/heads/main/binary/ins_arm64 + chmod +x ./ins + clear + ./ins + else + echo "Unsupported architecture: $ARCH" + exit 1 + fi + + rm ./ins + exit 0 +} + +function WebTest_Reddit() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Reddit:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.reddit.com/' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + case "$result" in + '000') echo -n -e "\r Reddit:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '403') echo -n -e "\r Reddit:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '200') echo -n -e "\r Reddit:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r Reddit:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_Popcornflix() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Popcornflix:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -s 'https://popcornflix-prod.cloud.seachange.com/cms/popcornflix/clientconfiguration/versions/2' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + if [ "$result" == '000' ]; then + echo -n -e "\r Popcornflix:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + case "$result" in + '403') echo -n -e "\r Popcornflix:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '200') echo -n -e "\r Popcornflix:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r Popcornflix:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_TubiTV() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://tubitv.com/home' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Tubi TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -i 'not currently available in your area') + local isOK=$(echo "$tmpresult" | grep -i 'manifest') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r Tubi TV:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ -n "$isBlocked" ]; then + echo -n -e "\r Tubi TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r Tubi TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Tubi TV:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_Philo() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Philo:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://content-us-east-2-fastly-b.www.philo.com/geo' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Philo:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"status"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$result" ]; then + echo -n -e "\r Philo:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + case "$result" in + 'FAIL') echo -n -e "\r Philo:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + 'SUCCESS') echo -n -e "\r Philo:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r Philo:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_FXNOW() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r FXNOW:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://fxnow.fxnetworks.com/' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r FXNOW:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -i 'is not accessible') + local isOK=$(echo "$tmpresult" | grep -i "FX Movies") + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r FXNOW:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ -n "$isBlocked" ]; then + echo -n -e "\r FXNOW:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r FXNOW:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r FXNOW:\t\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_Crunchyroll() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Crunchyroll:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://c.evidon.com/geo/country.js' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Crunchyroll:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep "'code':'us'") + if [ -z "$result" ]; then + echo -n -e "\r Crunchyroll:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + else + echo -n -e "\r Crunchyroll:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + fi +} + +function MediaUnlockTest_CWTV() { + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL "https://www.cwtv.com/" -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r CW TV:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '403'|'451') echo -n -e "\r CW TV:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '200') echo -n -e "\r CW TV:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r CW TV:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_Shudder() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://www.shudder.com/' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Shudder:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -iE 'not available|not yet available|403 ERROR') + local isOK=$(echo "$tmpresult" | grep -i 'movies') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r Shudder:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ -n "$isBlocked" ]; then + echo -n -e "\r Shudder:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r Shudder:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Shudder:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_TLCGO() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r TLC GO:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local fakeDeviceId=$(gen_uuid) + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s "https://us1-prod-direct.tlc.com/token?deviceId=${fakeDeviceId}&realm=go&shortlived=true" -H 'accept-language: en-US,en;q=0.9' -H 'origin: https://go.tlc.com' -H 'referer: https://go.tlc.com/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H 'x-device-info: tlc/3.17.0 (desktop/desktop; Windows/NT 10.0; ${fakeDeviceId})' -H 'x-disco-client: WEB:UNKNOWN:tlc:3.17.0' -H 'x-disco-params: realm=go,siteLookupKey=tlc,bid=tlc,hn=go.tlc.com,hth=us,features=ar' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r TLC GO:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local token=$(echo "$tmpresult" | grep -woP '"token"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$token" ]; then + echo -n -e "\r TLC GO:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + local tmpresult1=$(curl ${CURL_DEFAULT_OPTS} -s 'https://us1-prod-direct.tlc.com/cms/routes/home?include=default&decorators=viewingHistory,isFavorite,playbackAllowed&page\[items.number\]=1&page\[items.size\]=8' -H 'accept-language: en-US,en;q=0.9' -H "Authorization: Bearer ${token}" -H 'origin: https://go.tlc.com' -H 'referer: https://go.tlc.com/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H 'x-disco-client: WEB:UNKNOWN:tlc:3.17.0' -H 'x-disco-params: realm=go,siteLookupKey=tlc,bid=tlc,hn=go.tlc.com,hth=us,features=ar' --user-agent "${UA_BROWSER}") + + local isBlocked=$(echo "$tmpresult1" | grep -i 'is not yet available') + local isOK=$(echo "$tmpresult1" | grep -i 'Episodes') + local region=$(echo "$tmpresult1" | grep -woP '"mainTerritoryCode"\s{0,}:\s{0,}"\K[^"]+' | tr a-z A-Z) + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r TLC GO:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ -n "$isBlocked" ]; then + echo -n -e "\r TLC GO:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r TLC GO:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r TLC GO:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function RegionTest_oneTrust() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://geolocation.onetrust.com/cookieconsentpub/v1/geo/location' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r OneTrust Region:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local region=$(echo "$tmpresult" | grep -woP '"country"\s{0,}:\s{0,}"\K[^"]+') + local stateName=$(echo "$tmpresult" | grep -woP '"stateName"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$region" ]; then + echo -n -e "\r OneTrust Region:\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ -z "$stateName" ]; then + local stateName='Unknown' + fi + + echo -n -e "\r OneTrust Region:\t\t\t${Font_Green}${region} [${stateName}]${Font_Suffix}\n" +} + +function MediaUnlockTest_Wavve() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Wavve:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://apis.wavve.com/fz/streaming?device=pc&partner=pooq&apikey=E5F3E0D30947AA5440556471321BB6D9&credential=none&service=wavve&pooqzone=none®ion=kor&drm=pr&targetage=all&contentid=MV_C3001_C300000012559&contenttype=movie&hdr=sdr&videocodec=avc&audiocodec=ac3&issurround=n&format=normal&withinsubtitle=n&action=dash&protocol=dash&quality=auto&deviceModelId=Windows%2010&guid=1a8e9c88-6a3b-11ed-8584-eed06ef80652&lastplayid=none&authtype=cookie&isabr=y&ishevc=n' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + if [ "$result" == '000' ]; then + echo -n -e "\r Wavve:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + case "$result" in + '403'|'550') echo -n -e "\r Wavve:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '200') echo -n -e "\r Wavve:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r Wavve:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_Tving() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Tving:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://api.tving.com/v2a/media/stream/info?apiKey=1e7952d0917d6aab1f0293a063697610&mediaCode=RV60891248' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Tving:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -i 'available in South Korea') + local isOK=$(echo "$tmpresult" | grep 'vod_type') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r Tving:\t\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ -n "$isBlocked" ]; then + echo -n -e "\r Tving:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r Tving:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Tving:\t\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_CoupangPlay() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Coupang Play:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://www.coupangplay.com/' -w '%{http_code}_TAG_%{url_effective}\n' -o /dev/null --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Coupang Play:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local isBlocked=$(echo "$urlEffective" | grep -i 'not-available') + + if [ -n "$isBlocked" ]; then + echo -n -e "\r Coupang Play:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '403' ]; then + echo -n -e "\r Coupang Play:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + echo -n -e "\r Coupang Play:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Coupang Play:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_NaverTV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Naver TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local ts=$(date +%s%3N) + local base_url='https://apis.naver.com/' + local key='nbxvs5nwNG9QKEWK0ADjYA4JZoujF4gHcIwvoCxFTPAeamq5eemvt5IWAYXxrbYM' + local sign_text="https://apis.naver.com/now_web2/now_web_api/v1/clips/31030608/play-info${ts}" + local signature=$(printf "%s" "${sign_text}" | openssl dgst -sha1 -hmac "${key}" -binary | openssl base64) + local signature_encoded=$(printf "%s" "${signature}" | sed 's/ /%20/g;s/!/%21/g;s/"/%22/g;s/#/%23/g;s/\$/%24/g;s/\&/%26/g;s/'\''/%27/g;s/(/%28/g;s/)/%29/g;s/\*/%2a/g;s/+/%2b/g;s/,/%2c/g;s/\//%2f/g;s/:/%3a/g;s/;/%3b/g;s/=/%3d/g;s/?/%3f/g;s/@/%40/g;s/\[/%5b/g;s/\]/%5d/g') + local req_url="${base_url}now_web2/now_web_api/v1/clips/31030608/play-info?msgpad=${ts}&md=${signature_encoded}" + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s "${req_url}" --user-agent "${UA_Browser}" -H 'host: apis.naver.com' -H "sec-ch-ua: ${UA_SecCHUA}" -H 'accept: application/json, text/plain, */*' -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'origin: https://tv.naver.com' -H 'sec-fetch-site: same-site' -H 'sec-fetch-mode: cors' -H 'sec-fetch-dest: empty' -H 'referer: https://tv.naver.com/v/31030608' -H 'accept-language: en-US,en;q=0.9') + + if [ -z "$tmpresult" ]; then + echo -n -e "\r Naver TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"playable"\s{0,}:\s{0,}"\K[^"]+') + + case "$result" in + 'NOT_COUNTRY_AVAILABLE') echo -n -e "\r Naver TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + 'PLAYABLE') echo -n -e "\r Naver TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '') echo -n -e "\r Naver TV:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" ;; + *) echo -n -e "\r Naver TV:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_Afreeca() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r Afreeca TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://vod.afreecatv.com/player/97464151' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Afreeca TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep "document.location.href='https://vod.afreecatv.com'" ) + if [ -z "$result" ]; then + echo -n -e "\r Afreeca TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + else + echo -n -e "\r Afreeca TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + fi +} + +function MediaUnlockTest_KBSDomestic() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r KBS Domestic:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://vod.kbs.co.kr/index.html?source=episode&sname=vod&stype=vod&program_code=T2022-0690&program_id=PS-2022164275-01-000&broadcast_complete_yn=N&local_station_code=00§ion_code=03' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r KBS Domestic:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep 'ipck' | grep -woP 'Domestic\\\"\s{0,}:\s{0,}\K(false|true)') + + if [ -z "$result" ]; then + echo -n -e "\r KBS Domestic:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ "$result" == 'true' ]; then + echo -n -e "\r KBS Domestic:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + if [ "$result" == 'false' ]; then + echo -n -e "\r KBS Domestic:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + echo -n -e "\r KBS Domestic:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_KBSAmerican() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r KBS American:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://vod.kbs.co.kr/index.html?source=episode&sname=vod&stype=vod&program_code=T2022-0690&program_id=PS-2022164275-01-000&broadcast_complete_yn=N&local_station_code=00§ion_code=03' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r KBS American:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep 'ipck' | grep -woP 'Domestic\\\"\s{0,}:\s{0,}\K(false|true)') + + if [ -z "$result" ]; then + echo -n -e "\r KBS American:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ "$result" == 'true' ]; then + echo -n -e "\r KBS American:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + if [ "$result" == 'false' ]; then + echo -n -e "\r KBS American:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + echo -n -e "\r KBS American:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_Watcha() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r WATCHA:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://watcha.com/' -w %{http_code} -o /dev/null -H 'host: watcha.com' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'upgrade-insecure-requests: 1' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'sec-fetch-site: none' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-user: ?1' -H 'sec-fetch-dest: document' -H 'accept-language: en-US,en;q=0.9' --user-agent "${UA_BROWSER}") + + case "$result" in + '000') echo -n -e "\r WATCHA:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;; + '200') echo -n -e "\r WATCHA:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '451') echo -n -e "\r WATCHA:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r WATCHA:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_KOCOWA() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r KOCOWA:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.kocowa.com/' -w %{http_code} -o /dev/null --user-agent "${UA_BROWSER}") + + if [ "$result" == '000' ]; then + echo -n -e "\r KOCOWA:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + case "$result" in + '200') echo -n -e "\r KOCOWA:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '403') echo -n -e "\r KOCOWA:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r KOCOWA:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_NBCTV() { + local fakeUuid=$(gen_uuid | tr a-z A-Z) + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://geolocation.digitalsvc.apps.nbcuni.com/geolocation/live/usa' -H 'accept: application/media.geo-v2+json' -H 'accept-language: en-US,en;q=0.9' -H "app-session-id: ${fakeUuid}" -H 'authorization: NBC-Basic key="usa_live", version="3.0", type="cpc"' -H 'client: oneapp' -H 'content-type: application/json' -H 'origin: https://www.nbc.com' -H 'referer: https://www.nbc.com/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: cross-site' --data-raw '{"adobeMvpdId":null,"serviceZip":null,"device":"web"}' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r NBC TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"restricted"\s{0,}:\s{0,}\K(false|true)') + + case "$result" in + 'false') echo -n -e "\r NBC TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + 'true') echo -n -e "\r NBC TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '') echo -n -e "\r NBC TV:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" ;; + *) echo -n -e "\r NBC TV:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_Crackle() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sLi 'https://prod-api.crackle.com/appconfig' -w "_TAG_%{http_code}_TAG_" -H 'Accept-Language: en-US,en;q=0.9' -H 'Content-Type: application/json' -H 'Origin: https://www.crackle.com' -H 'Referer: https://www.crackle.com/' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-site' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'x-crackle-apiversion: v2.0.0' -H 'x-crackle-brand: crackle' -H 'x-crackle-platform: 5FE67CCA-069A-42C6-A20F-4B47A8054D46' --user-agent "${UA_BROWSER}") + + local httpCode=$(echo "$tmpresult" | grep '_TAG_' | awk -F'_TAG_' '{print $2}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Crackle:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local region=$(echo "$tmpresult" | grep -woP 'x-crackle-region:\s{0,}\K[A-Z]+') + + if [ -z "$region" ]; then + echo -n -e "\r Crackle:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ "$region" == 'US' ]; then + echo -n -e "\r Crackle:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + else + echo -n -e "\r Crackle:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + fi +} + +function MediaUnlockTest_AETV() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r A&E TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://link.theplatform.com/s/xc6n8B/UR27JDU0bu2s/' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r A&E TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -i 'GeoLocationBlocked') + if [ -n "$isBlocked" ]; then + echo -n -e "\r A&E TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + local tmpresult1=$(curl ${CURL_DEFAULT_OPTS} -s 'https://play.aetv.com/' -o /dev/null -D - --user-agent "${UA_BROWSER}") + + local region=$(echo "$tmpresult1" | grep -woP 'AETN-Country-Code=\K[A-Z]+' | head -n 1) + if [ -z "$region" ]; then + echo -n -e "\r A&E TV:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + case "$region" in + 'CA'|'US') echo -n -e "\r A&E TV:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r A&E TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_NFLPlus() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r NFL+:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.nfl.com/plus/' -w '%{http_code}_TAG_%{url_effective}\n' -o dev/null --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r NFL+:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}') + local isBlocked=$(echo "$urlEffective" | grep -iE 'nfl-game-pass|gpi.nfl.com') + + if [ -n "$isBlocked" ]; then + echo -n -e "\r NFL+:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ "$httpCode" == '200' ]; then + echo -n -e "\r NFL+:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r NFL+:\t\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n" +} + +function MediaUnlockTest_SkyShowTime() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.skyshowtime.com/' -w "_TAG_%{http_code}_TAG_" -o /dev/null -D - -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' --user-agent "${UA_BROWSER}") + + local httpCode=$(echo "$tmpresult" | grep '_TAG_' | awk -F'_TAG_' '{print $2}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r SkyShowTime:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + if [ "$httpCode" == '403' ]; then + echo -n -e "\r SkyShowTime:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -i 'where-can-i-stream') + if [ -n "$isBlocked" ]; then + echo -n -e "\r SkyShowTime:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + local region=$(echo "$tmpresult" | grep -woP 'activeTerritory=\K[A-Z]+' | head -n 1) + if [ -z "$region" ]; then + echo -n -e "\r SkyShowTime:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ "$httpCode" == '200' ]; then + echo -n -e "\r SkyShowTime:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r SkyShowTime:\t\t\t\t${Font_Red}Faild (Error: ${httpCode})${Font_Suffix}\n" +} + +function GameTest_MathsSpot() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r MathsSpot Roblox:\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://mathsspot.com/' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r MathsSpot Roblox:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -i 'FailureServiceNotInRegion') + if [ -n "$isBlocked" ]; then + echo -n -e "\r MathsSpot Roblox:\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + local apiPath=$(echo "$tmpresult" | grep -woP 'fetch\("\K[^"]+' | grep 'reportEvent' | sed 's/\/reportEvent//;s/^\///') + local region=$(echo "$tmpresult" | grep -woP '"countryCode"\s{0,}:\s{0,}"\K[^"]+') + local nggFeVersion=$(echo "$tmpresult" | grep -woP '"NEXT_PUBLIC_FE_VERSION"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$apiPath" ] || [ -z "$nggFeVersion" ] || [ -z "$region" ]; then + echo -n -e "\r MathsSpot Roblox:\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + local fakeUAId=$(gen_random_str 21) + local fakeSessId=$(gen_random_str 21) + local fakeFesessId=$(gen_random_str 21) + local fakeVisitId=$(gen_random_str 21) + + local tmpresult1=$(curl ${CURL_DEFAULT_OPTS} -sL "https://mathsspot.com/${apiPath}/startSession?appId=5349&uaId=ua-${fakeUAId}&uaSessionId=uasess-${fakeSessId}&feSessionId=fesess-${fakeFesessId}&visitId=visitid-${fakeVisitId}&initialOrientation=landscape&utmSource=NA&utmMedium=NA&utmCampaign=NA&deepLinkUrl=&accessCode=&ngReferrer=NA&pageReferrer=NA&ngEntryPoint=https%3A%2F%2Fmathsspot.com%2F&ntmSource=NA&customData=&appLaunchExtraData=&feSessionTags=nowgg&sdpType=&eVar=&isIframe=false&feDeviceType=desktop&feOsName=window&userSource=direct&visitSource=direct&userCampaign=NA&visitCampaign=NA" -H 'accept: */*' -H 'accept-language: en-US,en;q=0.9' -H 'referer: https://mathsspot.com/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-origin' -H 'x-ngg-skip-evar-check: true' -H "x-ngg-fe-version: ${nggFeVersion}") + if [ -z "$tmpresult1" ]; then + echo -n -e "\r MathsSpot Roblox:\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + + local status=$(echo "$tmpresult1" | grep -woP '"status"\s{0,}:\s{0,}"\K[^"]+' | head -n 1) + if [ -z "$status" ]; then + echo -n -e "\r MathsSpot Roblox:\t\t\t${Font_Red}Failed (Error: PAGE ERROR 1)${Font_Suffix}\n" + return + fi + + case "$status" in + 'FailureServiceNotInRegion') echo -n -e "\r MathsSpot Roblox:\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + 'FailureProxyUserLimitExceeded') echo -n -e "\r MathsSpot Roblox:\t\t\t${Font_Red}No (Proxy/VPN Detected)${Font_Suffix}\n" ;; + 'Success') echo -n -e "\r MathsSpot Roblox:\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" ;; + *) echo -n -e "\r MathsSpot Roblox:\t\t\t${Font_Red}Failed (Error: $status)${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_BGlobalSEA() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r B-Global SouthEastAsia:\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://api.bilibili.tv/intl/gateway/web/playurl?s_locale=en_US&platform=web&ep_id=347666' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r B-Global SouthEastAsia:\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}\K[-\d]+' | head -n 1) + + case "$result" in + '0') echo -n -e "\r B-Global SouthEastAsia:\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '10003003'|'10004001') echo -n -e "\r B-Global SouthEastAsia:\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r B-Global SouthEastAsia:\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_BGlobalTH() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r B-Global Thailand Only:\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://api.bilibili.tv/intl/gateway/web/playurl?s_locale=en_US&platform=web&ep_id=10077726' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r B-Global Thailand Only:\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}\K[-\d]+' | head -n 1) + + case "$result" in + '0') echo -n -e "\r B-Global Thailand Only:\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '10003003'|'10004001') echo -n -e "\r B-Global Thailand Only:\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r B-Global Thailand Only:\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_BGlobalID() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r B-Global Indonesia Only:\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://api.bilibili.tv/intl/gateway/web/playurl?s_locale=en_US&platform=web&ep_id=11130043' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r B-Global Indonesia Only:\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}\K[-\d]+' | head -n 1) + + case "$result" in + '0') echo -n -e "\r B-Global Indonesia Only:\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '10003003'|'10004001') echo -n -e "\r B-Global Indonesia Only:\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r B-Global Indonesia Only:\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_BGlobalVN() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r B-Global Việt Nam Only:\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://api.bilibili.tv/intl/gateway/web/playurl?s_locale=en_US&platform=web&ep_id=11405745' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r B-Global Việt Nam Only:\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}\K[-\d]+' | head -n 1) + + case "$result" in + '0') echo -n -e "\r B-Global Việt Nam Only:\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '10003003'|'10004001') echo -n -e "\r B-Global Việt Nam Only:\t\t${Font_Red}No${Font_Suffix}\n" ;; + *) echo -n -e "\r B-Global Việt Nam Only:\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_AISPlay() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r AIS Play:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local userId='09e8b25510' + local userPasswd='e49e9f9e7f' + local fakeApiKey=$(gen_uuid | md5sum | cut -f1 -d' ') + local fakeUdid=$(gen_uuid | md5sum | cut -f1 -d' ') + local timestamp=$(date +%s) + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL "https://web-tls.ais-vidnt.com/device/login/?d=gstweb&gst=1&user=${userId}&pass=${userPasswd}" -H 'accept-language: th' -H 'api-version: 2.8.2' -H "api_key: ${fakeApiKey}" -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundaryBj2RhUIW7BtRvfK0' -H 'device-info: com.vimmi.ais.portal, Windows + Chrome, AppVersion: 4.9.97, 10, language: tha' -H 'origin: https://aisplay.ais.co.th' -H "privateid: ${userId}" -H 'referer: https://aisplay.ais.co.th/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: cross-site' -H "time: ${timestamp}" -H "udid: ${fakeUdid}" --data-raw $'------WebKitFormBoundaryBj2RhUIW7BtRvfK0--\r\n' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r AIS Play:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local sId=$(echo "$tmpresult" | grep -woP '"sid"\s{0,}:\s{0,}"\K[^"]+') + local datAuth=$(echo "$tmpresult" | grep -woP '"dat"\s{0,}:\s{0,}"\K[^"]+') + # 新时间戳 + local timestamp=$(date +%s) + # 取播放模板 + local tmpresult1=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://web-sila.ais-vidnt.com/playtemplate/?d=gstweb' -H 'accept-language: en-US,en;q=0.9' -H 'api-version: 2.8.2' -H "api_key: ${fakeApiKey}" -H "dat: ${datAuth}" -H 'device-info: com.vimmi.ais.portal, Windows + Chrome, AppVersion: 0.0.0, 10, Language: unknown' -H 'origin: https://web-player.ais-vidnt.com' -H "privateid: ${userId}" -H 'referer: https://web-player.ais-vidnt.com/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H "sid: ${sId}" -H "time: ${timestamp}" -H "udid: ${fakeUdid}" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult1" ]; then + echo -n -e "\r AIS Play:\t\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + + local tmpLiveUrl=$(echo "$tmpresult1" | grep -woP '"live"\s{0,}:\s{0,}"\K[^"]+') + if [ -z "$tmpLiveUrl" ]; then + echo -n -e "\r AIS Play:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + local mediaId='B0006' + local realLiveUrl=$(echo "$tmpLiveUrl" | sed "s/{MID}/${mediaId}/g;s/metadata.xml/metadata.json/g" ) + local realLiveUrl="${realLiveUrl}-https&tuid=${userId}&tdid=${fakeUdid}&chunkHttps=true&origin=anevia" + # example: 'https://redirector.ais-vidnt.com/live/ais/B0006/hls/metadata.json?https_streaming=true&tt=f0037b2dae1b884e32fa90f00f146b7e&tpbk=DOGPcIOg1bIpIIrW&tfa=f0-fc&tttlt=1716631179&cdn=live_free-https&tuid=09e8b25510&tdid=01552b8e90f7e9f9e94ea4779cec29e6&chunkHttps=true&origin=anevia' + + # 取剧集播放网址 + local tmpresult2=$(curl ${CURL_DEFAULT_OPTS} -sL "$realLiveUrl" -H 'Accept-Language: en-US,en;q=0.9' -H 'Origin: https://web-player.ais-vidnt.com' -H 'Referer: https://web-player.ais-vidnt.com/' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-site' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' --user-agent "${UA_BROWSER}") + + # 取第一优先级播放地址 + local playUrl=$(echo "$tmpresult2" | grep -woP '"url"\s{0,}:\s{0,}"\K[^"]+' | grep 'rewriter' | head -n 1) + if [ -z "$playUrl" ]; then + echo -n -e "\r AIS Play:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + local tmpresult3=$(curl ${CURL_DEFAULT_OPTS} -sLi "$playUrl" -H 'Accept-Language: en-US,en;q=0.9' -H 'Origin: https://web-player.ais-vidnt.com' -H 'Referer: https://web-player.ais-vidnt.com/' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-site' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' --user-agent "${UA_BROWSER}") + + # X-Base-Request-Check-Status: INCORRECT X-Geo-Protection-System-Status: BLOCK + local baseRequstCheckStatus=$(echo "$tmpresult3" | grep -woP 'X-Base-Request-Check-Status:\s{0,}\K\w+') + if [ -z "$baseRequstCheckStatus" ]; then + echo -n -e "\r AIS Play:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + if [ "$baseRequstCheckStatus" == 'INCORRECT' ]; then + echo -n -e "\r AIS Play:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + local result="$(echo "$tmpresult3" | grep -woP 'X-Geo-Protection-System-Status:\s{0,}\K\w+')" + + case "$result" in + 'BLOCK') echo -n -e "\r AIS Play:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + 'ALLOW') echo -n -e "\r AIS Play:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + '') echo -n -e "\r AIS Play:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" ;; + *) echo -n -e "\r AIS Play:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function WebTest_OpenAI() { + local tmpresult1=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.openai.com/compliance/cookie_requirements' -H 'authority: api.openai.com' -H 'accept: */*' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer null' -H 'content-type: application/json' -H 'origin: https://platform.openai.com' -H 'referer: https://platform.openai.com/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' --user-agent "${UA_BROWSER}") + local tmpresult2=$(curl ${CURL_DEFAULT_OPTS} -s 'https://ios.chat.openai.com/' -H 'authority: ios.chat.openai.com' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult1" ]; then + echo -n -e "\r ChatGPT:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + if [ -z "$tmpresult2" ]; then + echo -n -e "\r ChatGPT:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result1=$(echo "$tmpresult1" | grep -i 'unsupported_country') + local result2=$(echo "$tmpresult2" | grep -i 'VPN') + if [ -z "$result2" ] && [ -z "$result1" ]; then + echo -n -e "\r ChatGPT:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + if [ -n "$result2" ] && [ -n "$result1" ]; then + echo -n -e "\r ChatGPT:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -z "$result1" ] && [ -n "$result2" ]; then + echo -n -e "\r ChatGPT:\t\t\t\t${Font_Yellow}No (Only Available with Web Browser)${Font_Suffix}\n" + return + fi + if [ -n "$result1" ] && [ -z "$result2" ]; then + echo -n -e "\r ChatGPT:\t\t\t\t${Font_Yellow}No (Only Available with Mobile APP)${Font_Suffix}\n" + return + fi + + echo -n -e "\r ChatGPT:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function WebTest_Gemini() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL "https://gemini.google.com" --user-agent "${UA_BROWSER}") + if [[ "$tmpresult" = "curl"* ]]; then + echo -n -e "\r Google Gemini:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + result=$(echo "$tmpresult" | grep -q '45631641,null,true' && echo "Yes" || echo "") + countrycode=$(echo "$tmpresult" | grep -o ',2,1,200,"[A-Z]\{3\}"' | sed 's/,2,1,200,"//;s/"//' || echo "") + if [ -n "$result" ] && [ -n "$countrycode" ]; then + echo -n -e "\r Google Gemini:\t\t\t\t${Font_Green}Yes (Region: $countrycode)${Font_Suffix}\n" + return + elif [ -n "$result" ]; then + echo -n -e "\r Google Gemini:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + else + echo -n -e "\r Google Gemini:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi +} + +function WebTest_Claude() { + local UA_Browser="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36" + local response=$(curl ${CURL_DEFAULT_OPTS} -s -o /dev/null -w "%{http_code}" -A "${UA_Browser}" "https://claude.ai/") + if [ -z "$response" ]; then + echo -n -e "\r Claude:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + if [ "$response" -eq 200 ]; then + echo -n -e "\r Claude:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + else + echo -n -e "\r Claude:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + fi +} + +function WebTest_MetaAI() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://www.meta.ai/' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Meta AI:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -i 'AbraGeoBlockedErrorRoot') + local isOK=$(echo "$tmpresult" | grep -i 'AbraHomeRootConversationQuery') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r Meta AI:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ -n "$isBlocked" ]; then + echo -n -e "\r Meta AI:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + if [ -n "$isOK" ]; then + local region=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}"\K[^"]+' | cut -d'_' -f2) + echo -n -e "\r Meta AI:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r Meta AI:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function RegionTest_Bing() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://www.bing.com/search?q=curl' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Bing Region:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isCN=$(echo "$tmpresult" | grep 'cn.bing.com') + local region=$(echo "$tmpresult" | grep -woP 'Region\s{0,}:\s{0,}"\K[^"]+') + + if [ -n "$isCN" ]; then + local region='CN' + echo -n -e "\r Bing Region:\t\t\t\t${Font_Yellow}${region}${Font_Suffix}\n" + return + fi + + local isRisky=$(echo "$tmpresult" | grep 'sj_cook.set("SRCHHPGUSR","HV"') + + if [ -n "$isRisky" ]; then + echo -n -e "\r Bing Region:\t\t\t\t${Font_Yellow}${region} (Risky)${Font_Suffix}\n" + return + fi + + echo -n -e "\r Bing Region:\t\t\t\t${Font_Green}${region}${Font_Suffix}\n" +} + +function WebTest_Wikipedia_Editable() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://zh.wikipedia.org/w/index.php?title=Wikipedia%3A%E6%B2%99%E7%9B%92&action=edit' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Wikipedia Editability:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -i 'Banned') + if [ -z "$result" ]; then + echo -n -e "\r Wikipedia Editability:\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Wikipedia Editability:\t\t\t${Font_Red}No${Font_Suffix}\n" +} + +function MediaUnlockTest_K_PLUS() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r K+:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local token=$(curl ${CURL_DEFAULT_OPTS} -s -H "Origin: https://xem.kplus.vn" -H "Referer: https://xem.kplus.vn/" -X POST -d '{"osVersion":"Windows NT 10.0","appVersion":"114.0.0.0","deviceModel":"Chrome","deviceType":"PC","deviceSerial":"w39db81c0-a2e9-11ed-952a-49b91c9e6f09","deviceOem":"Chrome","devicePrettyName":"Chrome","ssoToken":"eyJrZXkiOiJ2c3R2IiwiZW5jIjoiQTEyOENCQy1IUzI1NiIsImFsZyI6ImRpciJ9..MWbBlLuci2KNLl9lvMe63g.IbBX7-dg3BWaXzzoxTQz-pJFulm_Y8axWLuG5DcJxQ9jTUPOhA2e6dzOP2hryAFVPFoIRs97ONGTHEYTFQgUtRlvqvx53jyTi3yegU6zWhJnhYZA2sdaj9khsNvVAth0zcWFoWA9GGwfNE5TZLOwczAexIxqC1Ee-tQDILC4XklFrJfvdzoCQBABRXpD_O4HHHIYFs0jBMtYSyD9Vq7dTD61sAVca_83lav7jvpP17PuAo3HHIFQtUdcugpgkB91mJbABIDTPdo0mqdzbgTA_FilwO1Z5qnpwqIZIXy0bhVXFFcwUZPIUxjLEVzP3SyHceFF5N-v7OeYhYZRLYuBKxWj1cRb3LAa3FGJvefqRsBadlsr0cZnOgx0TsL51a2SaIpNyyGtaq8KTTLULIZBb2Zsq2jmBkZtxjoPxUR8ku7J4sL0tfLDoMlWVZkrX4_1tls3E-l8Ael-wd0kbS1i2vpf-Vdh80lRClpDg3ibSSUFPsp3wYMFsuKfyY8vpHrCfYDJDDbYOSv20sfnU7q7gcmizTCFBuiszmXbFX9_aH8UOaCGeqkYDV1ZZ3mQ26TM7JEquuZTV09wdi81ABoM8RZcb2ua0cuocaO4-asMh8KQWNea9BCYlKK5NSPz--oGgGxSdvxZ63qQz1Lr4QZytA2buoQV5OlMoEP7k87fPcig5rPqsK7aeWUXJSmfiOBbSLztoiamvvHClMpds3frv0ud8NWUUoijmS_JUGfF7XYNxWWqEGJuDUoSllV5MVwtIb5wM069gR7zknrr5aRVDi3Nho16KHQ_iB3vxoIr-ExajWLNlvo44CopGhxhgOAKPkULV356uamZpB7twY_iEVrwGMQA1_hEH4usO-UbzuxL_pssLhJKD4NjVcTe86Z08Bfm0IyiNWESmFkA6FVfsxu57Yfd4bXT8mxnfXXmklb7u7vB0RVYRo4i26QGJbPknybHdfgQWEvRCMoAjEG-E2LymBAMwFneWEpPTwBMpfvlTHnGnUtfViA4Zy1xqF2q95g9AF9nF3sE4YpYuSFSkUQB4sZd8emDApIdP6Avqsq809Gg06_R2sUGrD9SQ-XbXhvtAYMcaUcSv54hJvRcSUkygqU8tdg4tJHR23UBb-I.UfpC5BKhvt8EE5gpIFMQoQ","brand":"vstv","environment":"p","language":"en_US","memberId":"0","featureLevel":4,"provisionData":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYyI6dHJ1ZSwiaWF0IjoxNjg2NTc4NzYyLCJ1cCI6ImNwaSIsImRlIjoiYnJhbmRNYXBwaW5nIiwiYnIiOiJ2c3R2IiwiZHMiOiJ3MzlkYjgxYzAtYTJlOS0xMWVkLTk1MmEtNDliOTFjOWU2ZjA5In0.3mbI7wnJKtRf3493yc_ZEMEvzUXldwDx0sSZdwQnlNk"}' "https://tvapi-sgn.solocoo.tv/v1/session" | grep -woP '"token"\s{0,}:\s{0,}"\K[^"]+' | awk '{print $2}' | cut -f2 -d'"') + if [ -z "$token" ]; then + echo -n -e "\r K+:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s -X POST -d '{"player":{"name":"RxPlayer","version":"3.29.0","capabilities":{"mediaTypes":["DASH","DASH"],"drmSystems":["PlayReady","Widevine"],"smartLib":true}}}' -H "Content-Type: application/json" -H "Authorization: Bearer $token" "https://tvapi-sgn.solocoo.tv/v1/assets/BJO0h8jMwJWg5Id_4VLxIJ-VscUzRry_myp4aC21/play") + if [ -z "$tmpresult" ]; then + echo -n -e "\r K+:\t\t\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep 'geoblock') + + if [ -n "$result" ]; then + echo -n -e "\r K+:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + + echo -n -e "\r K+:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" +} + +function MediaUnlockTest_TV360() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r TV360:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'http://api-v2.tv360.vn/public/v1/composite/get-link?childId=998335&device_type=WEB_IPHONE&id=19474&network_device_id=prIUMaumjI7dNWKSUxFkEViFygs%3D&t=1686572228&type=film' -H "userid: 182551343" -H "devicetype: WEB_IPHONE" -H "deviceName: iPad Air 5th Gen (WiFi)" -H "profileid: 182733455" -H "s: cSkV/vwUfX6tahDwe6xh9Bl0yhNs/TdWTaOJiWDt3gHekijGnNYh9i4YaUmdfBfI4oKOwvioKJ7PuKMH7ctWA6rEHeGXH/nUYOY1g7l4Umh6zoed5bBwWCgUuh5eMqdNNoptwaeCee58USTteOkbHQ==" -H "deviceid: 69FFABD6-F9D8-4C2E-8C44-7195CF0A2930" -H "devicedrmid: prIUMaumjI7dNWKSUxFkEViFygs=" -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxODI1NTEzNDMiLCJ1c2VySWQiOjE4MjU1MTM0MywicHJvZmlsZUlkIjoxODI3MzM0NTUsImR2aSI6MjY5NDY3MTUzLCJjb250ZW50RmlsdGVyIjoiMTAwIiwiZ25hbWUiOiIiLCJpYXQiOjE2ODY1NzIyMDEsImV4cCI6MTY4NzE3NzAwMX0.oi0BKvATgBzPEkqR_liBrvMKXBUiWzp2BQme-biDnwiVhuta0qn_aZo6z3azLdjW5kH6PfEwEkc4K9jCfAK5rw" -H "osappversion: 1.9.27" -H "sessionid: C5017358-5327-4185-999A-CA3291CC66AC" -H "zoneid: 1" -H "Accept: application/json, text/html" -H "Content-Type: application/json" -H "osapptype: IPAD" -H "tv360transid: 1686572228_69FFABD6-F9D8-4C2E-8C44-7195CF0A2930" -H "User-Agent: TV360/31 CFNetwork/1402.0.8 Darwin/22.2.0") + if [ -z "$tmpresult" ]; then + echo -n -e "\r TV360:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -woP '"errorCode"\s{0,}:\s{0,}\K\d+') + + case "$result" in + '310') echo -n -e "\r TV360:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + '200') echo -n -e "\r TV360:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r TV360:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_MeWatch() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r MeWatch:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://cdn.mewatch.sg/api/items/97098/videos?delivery=stream%2Cprogressive&ff=idp%2Cldp%2Crpt%2Ccd&lang=en&resolution=External&segments=all' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r MeWatch:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isBlocked=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}\K\d+') + local isOK=$(echo "$tmpresult" | grep -i 'Stream') + + if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then + echo -n -e "\r MeWatch:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n" + return + fi + + if [ -n "$isBlocked" ]; then + echo -n -e "\r MeWatch:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r MeWatch:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r MeWatch:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_trueID() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r trueID:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL "https://tv.trueid.net/th-en/live/thairathtv-hd" -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: same-origin' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r trueID:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + local channelId=$(echo "$tmpresult" | grep -woP '"channelId"\s{0,}:\s{0,}"\K[^"]+' | head -n 1) + local authUser=$(echo "$tmpresult" | grep -woP '"buildId"\s{0,}:\s{0,}"\K[^"]+' | head -n 1) + local authKey=${authUser:10} + local tmpresult2=$(curl ${CURL_DEFAULT_OPTS} -s "https://tv.trueid.net/api/stream/checkedPlay?channelId=${channelId}&lang=en&country=th" -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: same-origin' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' -u ${authUser}:${authKey} -H 'accept: application/json, text/plain, */*' -H 'referer: https://tv.trueid.net/th-en/live/thairathtv-hd' --user-agent "${UA_BROWSER}") + + local result=$(echo "$tmpresult2" | grep -woP '"billboardType"\s{0,}:\s{0,}"\K[^"]+') + case "$result" in + 'GEO_BLOCK') echo -n -e "\r trueID:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;; + 'LOADING') echo -n -e "\r trueID:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;; + *) echo -n -e "\r trueID:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_SonyLiv() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://www.sonyliv.com/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r SonyLiv:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + local isBlocked=$(echo "$tmpresult" | grep 'geolocation_notsupported') + if [ -n "$isBlocked" ]; then + echo -n -e "\r SonyLiv:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + # 取得 JWT Token + local jwtToken=$(echo "$tmpresult" | grep 'securityToken' | sed 's/.*securityToken//' | sed 's/.*resultObj//' | cut -f2 -d'"' | head -n 1) + # 取得国家代码 + local tmpresult2=$(curl ${CURL_DEFAULT_OPTS} -s 'https://apiv2.sonyliv.com/AGL/1.4/A/ENG/WEB/ALL/USER/ULD' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'accept: application/json, text/plain, */*' -H 'referer: https://www.sonyliv.com/' -H 'device_id: 25a417c3b5f246a393fadb022adc82d5-1715309762699' -H 'app_version: 3.5.59' -H "security_token: ${jwtToken}" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult2" ]; then + echo -n -e "\r SonyLiv:\t\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + local region=$(echo "$tmpresult2" | grep -woP '"country_code"\s{0,}:\s{0,}"\K[^"]+') + # 取得播放详情 + local tmpresult3=$(curl ${CURL_DEFAULT_OPTS} -s "https://apiv2.sonyliv.com/AGL/3.8/A/ENG/WEB/${region}/ALL/CONTENT/VIDEOURL/VOD/1000045427/prefetch" -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: same-origin' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' -H 'accept: application/json, text/plain, */*' -H 'origin: https://www.sonyliv.com' -H 'referer: https://www.sonyliv.com/' -H 'device_id: 25a417c3b5f246a393fadb022adc82d5-1715309762699' -H "security_token: ${jwtToken}" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult3" ]; then + echo -n -e "\r SonyLiv:\t\t\t\t${Font_Red}Failed (Network Connection 2)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult3" | grep -woP '"resultCode"\s{0,}:\s{0,}"\K[^"]+') + local reason=$(echo "$tmpresult3" | grep -woP '"message"\s{0,}:\s{0,}"\K[^"]+') + case "$result" in + "KO") echo -n -e "\r SonyLiv:\t\t\t\t${Font_Red}No (${reason})${Font_Suffix}\n" ;; + "OK") echo -n -e "\r SonyLiv:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" ;; + *) echo -n -e "\r SonyLiv:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;; + esac +} + +function MediaUnlockTest_JioCinema() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://apis-jiocinema.voot.com/location' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.9' -H 'Origin: https://www.jiocinema.com' -H 'Referer: https://www.jiocinema.com/' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r Jio Cinema:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local tmpresult2=$(curl ${CURL_DEFAULT_OPTS} -s 'https://content-jiovoot.voot.com/psapi/voot/v1/voot-web//view/show/3500210?subNavId=38fa57ba_1706064514668&excludeTray=player-tray,subnav&responseType=common&devicePlatformType=desktop&page=1&layoutCohort=default&supportedChips=comingsoon' -X 'OPTIONS' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.9' -H 'Access-Control-Request-Headers: app-version' -H 'Access-Control-Request-Method: GET' -H 'Origin: https://www.jiocinema.com' -H 'Referer: https://www.jiocinema.com/' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult2" ]; then + echo -n -e "\r Jio Cinema:\t\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n" + return + fi + + local isBlocked1=$(echo "$tmpresult" | grep -i 'Access Denied') + local isOK1=$(echo "$tmpresult" | grep -i 'Success') + local isBlocked2=$(echo "$tmpresult2" | grep -i 'is unavailable at your') + local isOK2=$(echo "$tmpresult2" | grep -i 'Ok') + + if [ -n "$isBlocked1" ] || [ -n "$isBlocked2" ]; then + echo -n -e "\r Jio Cinema:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK1" ] && [ -n "$isOK2" ]; then + echo -n -e "\r Jio Cinema:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r Jio Cinema:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_MXPlayer() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r MX Player:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sLi 'https://www.mxplayer.in/' -w "_TAG_%{http_code}_TAG_" --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | grep '_TAG_' | awk -F'_TAG_' '{print $2}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r MX Player:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local isOK=$(echo "$tmpresult" | grep 'set-cookie') + local isBlocked=$(echo "$tmpresult" | grep -iE '403 ERROR|not available in your') + + if [ -n "$isBlocked" ]; then + echo -n -e "\r MX Player:\t\t\t\t${Font_Red}No${Font_Suffix}\n" + return + fi + if [ -n "$isOK" ]; then + echo -n -e "\r MX Player:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r MX Player:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function MediaUnlockTest_Zee5() { + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sLi 'https://www.zee5.com/' -w "_TAG_%{http_code}_TAG_" -H 'Upgrade-Insecure-Requests: 1' --user-agent "${UA_BROWSER}") + local httpCode=$(echo "$tmpresult" | grep '_TAG_' | awk -F'_TAG_' '{print $2}') + if [ "$httpCode" == '000' ]; then + echo -n -e "\r Zee5:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local region=$(echo "$tmpresult" | grep -woP 'country=\K[A-Z]{2}' | head -n 1) + if [ -n "$region" ]; then + echo -n -e "\r Zee5:\t\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" + return + fi + + echo -n -e "\r Zee5:\t\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n" +} + +function WebTest_EroGameSpace() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r EroGameSpace:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL "https://erogamescape.org" --user-agent "${UA_BROWSER}") + if [ -z "$tmpresult" ]; then + echo -n -e "\r EroGameSpace:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" + return + fi + + local result=$(echo "$tmpresult" | grep -i '18歳') + if [ -n "$result" ]; then + echo -n -e "\r EroGameSpace:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" + return + fi + + echo -n -e "\r EroGameSpace:\t\t\t\t${Font_Red}No${Font_Suffix}\n" +} + +function MediaUnlockTest_DAnimeStore() { + if [ "${USE_IPV6}" == 1 ]; then + echo -n -e "\r D Anime Store:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n" + return + fi + + local tmpresult=$(OPENSSL_CONF=<(cat <, + check_time: Option, +} + +// 获取当前本地时间字符串 +fn get_local_date_string() -> String { + let now = Local::now(); + now.format("%Y-%m-%d %H:%M:%S").to_string() +} + +// 将国家代码转换为对应的emoji +fn country_code_to_emoji(country_code: &str) -> String { + // 转换为大写 + let country_code = country_code.to_uppercase(); + + // 确保使用国家代码的前两个字符来生成emoji + if country_code.len() < 2 { + return String::new(); + } + + // 使用前两个字符生成emoji + let bytes = country_code.as_bytes(); + let c1 = 0x1F1E6 + (bytes[0] as u32) - ('A' as u32); + let c2 = 0x1F1E6 + (bytes[1] as u32) - ('A' as u32); + + char::from_u32(c1) + .and_then(|c1| char::from_u32(c2).map(|c2| format!("{}{}", c1, c2))) + .unwrap_or_default() +} + +// 测试哔哩哔哩中国大陆 +async fn check_bilibili_china_mainland(client: &Client) -> UnlockItem { + let url = "https://api.bilibili.com/pgc/player/web/playurl?avid=82846771&qn=0&type=&otype=json&ep_id=307247&fourk=1&fnver=0&fnval=16&module=bangumi"; + + let result = client.get(url).send().await; + + match result { + Ok(response) => match response.json::().await { + Ok(body) => { + if let Some(code) = body.get("code").and_then(|v| v.as_i64()) { + let status = if code == 0 { + "Yes" + } else if code == -10403 { + "No" + } else { + "Failed" + }; + + UnlockItem { + name: "哔哩哔哩大陆".to_string(), + status: status.to_string(), + region: None, + check_time: Some(get_local_date_string()), + } + } else { + UnlockItem { + name: "哔哩哔哩大陆".to_string(), + status: "Failed".to_string(), + region: None, + check_time: Some(get_local_date_string()), + } + } + } + Err(_) => UnlockItem { + name: "哔哩哔哩大陆".to_string(), + status: "Failed".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }, + }, + Err(_) => UnlockItem { + name: "哔哩哔哩大陆".to_string(), + status: "Failed".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }, + } +} + +// 测试哔哩哔哩港澳台 +async fn check_bilibili_hk_mc_tw(client: &Client) -> UnlockItem { + let url = "https://api.bilibili.com/pgc/player/web/playurl?avid=18281381&cid=29892777&qn=0&type=&otype=json&ep_id=183799&fourk=1&fnver=0&fnval=16&module=bangumi"; + + let result = client.get(url).send().await; + + match result { + Ok(response) => match response.json::().await { + Ok(body) => { + if let Some(code) = body.get("code").and_then(|v| v.as_i64()) { + let status = if code == 0 { + "Yes" + } else if code == -10403 { + "No" + } else { + "Failed" + }; + + UnlockItem { + name: "哔哩哔哩港澳台".to_string(), + status: status.to_string(), + region: None, + check_time: Some(get_local_date_string()), + } + } else { + UnlockItem { + name: "哔哩哔哩港澳台".to_string(), + status: "Failed".to_string(), + region: None, + check_time: Some(get_local_date_string()), + } + } + } + Err(_) => UnlockItem { + name: "哔哩哔哩港澳台".to_string(), + status: "Failed".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }, + }, + Err(_) => UnlockItem { + name: "哔哩哔哩港澳台".to_string(), + status: "Failed".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }, + } +} + +// 合并的ChatGPT检测功能,包含iOS和Web测试以及国家代码获取 +async fn check_chatgpt_combined(client: &Client) -> Vec { + // 结果集 + let mut results = Vec::new(); + + // 1. 获取国家代码 + let url_country = "https://chat.openai.com/cdn-cgi/trace"; + let result_country = client.get(url_country).send().await; + + // 解析区域信息 + let region = match result_country { + Ok(response) => { + if let Ok(body) = response.text().await { + let mut map = HashMap::new(); + for line in body.lines() { + if let Some(index) = line.find('=') { + let key = &line[0..index]; + let value = &line[index + 1..]; + map.insert(key.to_string(), value.to_string()); + } + } + + map.get("loc").map(|loc| { + let emoji = country_code_to_emoji(loc); + format!("{}{}", emoji, loc) + }) + } else { + None + } + } + Err(_) => None, + }; + + // 2. 测试 ChatGPT iOS + let url_ios = "https://ios.chat.openai.com/"; + let result_ios = client.get(url_ios).send().await; + + // 解析iOS测试结果 + let ios_status = match result_ios { + Ok(response) => { + if let Ok(body) = response.text().await { + let body_lower = body.to_lowercase(); + if body_lower.contains("you may be connected to a disallowed isp") { + "Disallowed ISP" + } else if body_lower.contains("request is not allowed. please try again later.") { + "Yes" + } else if body_lower.contains("sorry, you have been blocked") { + "Blocked" + } else { + "Failed" + } + } else { + "Failed" + } + } + Err(_) => "Failed", + }; + + // 3. 测试 ChatGPT Web + let url_web = "https://api.openai.com/compliance/cookie_requirements"; + let result_web = client.get(url_web).send().await; + + // 解析Web测试结果 + let web_status = match result_web { + Ok(response) => { + if let Ok(body) = response.text().await { + let body_lower = body.to_lowercase(); + if body_lower.contains("unsupported_country") { + "Unsupported Country" + } else { + "Yes" + } + } else { + "Failed" + } + } + Err(_) => "Failed", + }; + + // 添加iOS测试结果 + results.push(UnlockItem { + name: "ChatGPT iOS".to_string(), + status: ios_status.to_string(), + region: region.clone(), + check_time: Some(get_local_date_string()), + }); + + // 添加Web测试结果 + results.push(UnlockItem { + name: "ChatGPT Web".to_string(), + status: web_status.to_string(), + region, + check_time: Some(get_local_date_string()), + }); + + results +} + +// 测试Gemini +async fn check_gemini(client: &Client) -> UnlockItem { + let url = "https://gemini.google.com"; + + let result = client.get(url).send().await; + + match result { + Ok(response) => { + if let Ok(body) = response.text().await { + let is_ok = body.contains("45631641,null,true"); + let status = if is_ok { "Yes" } else { "No" }; + + // 尝试提取国家代码 + let re = Regex::new(r#",2,1,200,"([A-Z]{3})""#).unwrap(); + let region = re.captures(&body).and_then(|caps| { + caps.get(1).map(|m| { + let country_code = m.as_str(); + let emoji = country_code_to_emoji(country_code); + format!("{}{}", emoji, country_code) + }) + }); + + UnlockItem { + name: "Gemini".to_string(), + status: status.to_string(), + region, + check_time: Some(get_local_date_string()), + } + } else { + UnlockItem { + name: "Gemini".to_string(), + status: "Failed".to_string(), + region: None, + check_time: Some(get_local_date_string()), + } + } + } + Err(_) => UnlockItem { + name: "Gemini".to_string(), + status: "Failed".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }, + } +} + +// 测试YouTube Premium +async fn check_youtube_premium(client: &Client) -> UnlockItem { + let url = "https://www.youtube.com/premium"; + + let result = client.get(url).send().await; + + match result { + Ok(response) => { + if let Ok(body) = response.text().await { + let body_lower = body.to_lowercase(); + + if body_lower.contains("youtube premium is not available in your country") { + UnlockItem { + name: "Youtube Premium".to_string(), + status: "No".to_string(), + region: None, + check_time: Some(get_local_date_string()), + } + } else if body_lower.contains("ad-free") { + // 尝试解析国家代码 + let re = Regex::new(r#"id="country-code"[^>]*>([^<]+)<"#).unwrap(); + let region = re.captures(&body).and_then(|caps| { + caps.get(1).map(|m| { + let country_code = m.as_str().trim(); + let emoji = country_code_to_emoji(country_code); + format!("{}{}", emoji, country_code) + }) + }); + + UnlockItem { + name: "Youtube Premium".to_string(), + status: "Yes".to_string(), + region, + check_time: Some(get_local_date_string()), + } + } else { + UnlockItem { + name: "Youtube Premium".to_string(), + status: "Failed".to_string(), + region: None, + check_time: Some(get_local_date_string()), + } + } + } else { + UnlockItem { + name: "Youtube Premium".to_string(), + status: "Failed".to_string(), + region: None, + check_time: Some(get_local_date_string()), + } + } + } + Err(_) => UnlockItem { + name: "Youtube Premium".to_string(), + status: "Failed".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }, + } +} + +// 测试动画疯(Bahamut Anime) +async fn check_bahamut_anime(client: &Client) -> UnlockItem { + // 创建带Cookie存储的客户端 + let cookie_store = Arc::new(reqwest::cookie::Jar::default()); + + // 使用带Cookie的客户端 + let client_with_cookies = reqwest::Client::builder() + .user_agent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36") + .cookie_provider(Arc::clone(&cookie_store)) + .build() + .unwrap_or_else(|_| client.clone()); + + // 第一步:获取设备ID (会自动保存Cookie) + let device_url = "https://ani.gamer.com.tw/ajax/getdeviceid.php"; + let device_id = match client_with_cookies.get(device_url).send().await { + Ok(response) => { + match response.text().await { + Ok(text) => { + // 使用正则提取deviceid + let re = Regex::new(r#""deviceid"\s*:\s*"([^"]+)"#).unwrap(); + re.captures(&text) + .and_then(|caps| caps.get(1).map(|m| m.as_str().to_string())) + .unwrap_or_default() + } + Err(_) => String::new(), + } + } + Err(_) => String::new(), + }; + + if device_id.is_empty() { + return UnlockItem { + name: "Bahamut Anime".to_string(), + status: "Failed".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + // 第二步:使用设备ID检查访问权限 (使用相同的Cookie) + let url = format!( + "https://ani.gamer.com.tw/ajax/token.php?adID=89422&sn=37783&device={}", + device_id + ); + + let token_result = match client_with_cookies.get(&url).send().await { + Ok(response) => { + match response.text().await { + Ok(body) => { + // 检查内容是否可访问 - 更精确地匹配animeSn + if body.contains("animeSn") { + Some(body) + } else { + None + } + } + Err(_) => None, + } + } + Err(_) => None, + }; + + // 如果无法获取token或不包含animeSn,表示不支持 + if token_result.is_none() { + return UnlockItem { + name: "Bahamut Anime".to_string(), + status: "No".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + // 第三步:访问主页获取区域信息 (使用相同的Cookie) + let region = match client_with_cookies + .get("https://ani.gamer.com.tw/") + .send() + .await + { + Ok(response) => match response.text().await { + Ok(body) => { + let region_re = Regex::new(r#"data-geo="([^"]+)"#).unwrap(); + region_re + .captures(&body) + .and_then(|caps| caps.get(1)) + .map(|m| { + let country_code = m.as_str(); + let emoji = country_code_to_emoji(country_code); + format!("{}{}", emoji, country_code) + }) + } + Err(_) => None, + }, + Err(_) => None, + }; + + // 解锁成功 + UnlockItem { + name: "Bahamut Anime".to_string(), + status: "Yes".to_string(), + region, + check_time: Some(get_local_date_string()), + } +} + +// 测试 Netflix +async fn check_netflix(client: &Client) -> UnlockItem { + // 测试两个 Netflix 内容 (LEGO Ninjago 和 Breaking Bad) + let url1 = "https://www.netflix.com/title/81280792"; // LEGO Ninjago + let url2 = "https://www.netflix.com/title/70143836"; // Breaking Bad + + let headers = { + let mut headers = HeaderMap::new(); + headers.insert( + "accept-language", + HeaderValue::from_static("en-US,en;q=0.9"), + ); + headers.insert("sec-ch-ua-mobile", HeaderValue::from_static("?0")); + headers.insert( + "sec-ch-ua-platform", + HeaderValue::from_static("\"Windows\""), + ); + headers.insert("sec-fetch-site", HeaderValue::from_static("none")); + headers.insert("sec-fetch-mode", HeaderValue::from_static("navigate")); + headers.insert("sec-fetch-user", HeaderValue::from_static("?1")); + headers.insert("sec-fetch-dest", HeaderValue::from_static("document")); + headers + }; + + // 执行第一个请求 + let result1 = client.get(url1).headers(headers.clone()).send().await; + + // 执行第二个请求 + let result2 = client.get(url2).headers(headers.clone()).send().await; + + // 检查连接失败情况 + if result1.is_err() || result2.is_err() { + return UnlockItem { + name: "Netflix".to_string(), + status: "Failed (Network Connection)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + // 获取状态码 + let status1 = result1.unwrap().status().as_u16(); + let status2 = result2.unwrap().status().as_u16(); + + // 根据状态码判断解锁状况 + if status1 == 404 && status2 == 404 { + return UnlockItem { + name: "Netflix".to_string(), + status: "Originals Only".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + if status1 == 403 || status2 == 403 { + return UnlockItem { + name: "Netflix".to_string(), + status: "No".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + if status1 == 200 || status2 == 200 { + // 成功解锁,尝试获取地区信息 + match client + .get("https://www.netflix.com/") + .headers(headers) + .send() + .await + { + Ok(response) => { + if let Ok(body) = response.text().await { + // 使用正则表达式提取区域代码 + let re = Regex::new(r#""id":"([A-Z]{2})"#).unwrap(); + if let Some(caps) = re.captures(&body) { + if let Some(region_match) = caps.get(1) { + let region_code = region_match.as_str(); + let emoji = country_code_to_emoji(region_code); + return UnlockItem { + name: "Netflix".to_string(), + status: "Yes".to_string(), + region: Some(format!("{}{}", emoji, region_code)), + check_time: Some(get_local_date_string()), + }; + } + } + } + // 如果无法获取区域信息,仍然返回成功 + UnlockItem { + name: "Netflix".to_string(), + status: "Yes".to_string(), + region: None, + check_time: Some(get_local_date_string()), + } + } + Err(_) => UnlockItem { + name: "Netflix".to_string(), + status: "Yes".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }, + } + } else { + // 其他未知错误状态 + UnlockItem { + name: "Netflix".to_string(), + status: format!("Failed (Error: {}_{}", status1, status2), + region: None, + check_time: Some(get_local_date_string()), + } + } +} + +// 测试 Disney+ +async fn check_disney_plus(client: &Client) -> UnlockItem { + // Disney+ 不支持 IPv6,但这里不做额外检查,因为我们使用的是系统默认网络 + + // 第一步:获取 assertion + let device_api_url = "https://disney.api.edge.bamgrid.com/devices"; + let auth_header = + "Bearer ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84"; + + let device_req_body = serde_json::json!({ + "deviceFamily": "browser", + "applicationRuntime": "chrome", + "deviceProfile": "windows", + "attributes": {} + }); + + let device_result = client + .post(device_api_url) + .header("authorization", auth_header) + .header("content-type", "application/json; charset=UTF-8") + .json(&device_req_body) + .send() + .await; + + // 检查网络连接 + if device_result.is_err() { + return UnlockItem { + name: "Disney+".to_string(), + status: "Failed (Network Connection)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + let device_response = device_result.unwrap(); + + // 检查是否 403 错误 + if device_response.status().as_u16() == 403 { + return UnlockItem { + name: "Disney+".to_string(), + status: "No (IP Banned By Disney+)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + let device_body = match device_response.text().await { + Ok(body) => body, + Err(_) => { + return UnlockItem { + name: "Disney+".to_string(), + status: "Failed (Error: Cannot read response)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + }; + + // 提取 assertion + let re = Regex::new(r#""assertion"\s*:\s*"([^"]+)"#).unwrap(); + let assertion = match re.captures(&device_body) { + Some(caps) => caps.get(1).map(|m| m.as_str().to_string()), + None => None, + }; + + if assertion.is_none() { + return UnlockItem { + name: "Disney+".to_string(), + status: "Failed (Error: Cannot extract assertion)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + // 第二步:获取 token + let token_url = "https://disney.api.edge.bamgrid.com/token"; + + // 构建请求体 - 使用表单数据格式而非 JSON + let assertion_str = assertion.unwrap(); + let token_body = [ + ( + "grant_type", + "urn:ietf:params:oauth:grant-type:token-exchange", + ), + ("latitude", "0"), + ("longitude", "0"), + ("platform", "browser"), + ("subject_token", assertion_str.as_str()), + ( + "subject_token_type", + "urn:bamtech:params:oauth:token-type:device", + ), + ]; + + let token_result = client + .post(token_url) + .header("authorization", auth_header) + .header("content-type", "application/x-www-form-urlencoded") + .form(&token_body) // 使用 form 而不是 json + .send() + .await; + + if token_result.is_err() { + return UnlockItem { + name: "Disney+".to_string(), + status: "Failed (Network Connection)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + let token_response = token_result.unwrap(); + let token_status = token_response.status(); + + // 保存原始响应用于调试 + let token_body_text = match token_response.text().await { + Ok(body) => body, + Err(_) => { + return UnlockItem { + name: "Disney+".to_string(), + status: "Failed (Error: Cannot read token response)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + }; + + // 检查是否被禁止的地区 + if token_body_text.contains("forbidden-location") || token_body_text.contains("403 ERROR") { + return UnlockItem { + name: "Disney+".to_string(), + status: "No (IP Banned By Disney+)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + // 尝试解析 JSON + let token_json: Result = serde_json::from_str(&token_body_text); + + let refresh_token = match token_json { + Ok(json) => json + .get("refresh_token") + .and_then(|v| v.as_str()) + .map(|s| s.to_string()), + Err(_) => { + // 如果 JSON 解析失败,尝试使用正则表达式 + let refresh_token_re = Regex::new(r#""refresh_token"\s*:\s*"([^"]+)"#).unwrap(); + refresh_token_re + .captures(&token_body_text) + .and_then(|caps| caps.get(1).map(|m| m.as_str().to_string())) + } + }; + + // 如果仍然无法获取 refresh token + if refresh_token.is_none() { + return UnlockItem { + name: "Disney+".to_string(), + status: format!( + "Failed (Error: Cannot extract refresh token, status: {}, response: {})", + token_status.as_u16(), + token_body_text.chars().take(100).collect::() + "..." + ), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + // 第三步:使用 GraphQL 获取地区信息 + let graphql_url = "https://disney.api.edge.bamgrid.com/graph/v1/device/graphql"; + + // GraphQL API 通常接受 JSON 格式 + let graphql_payload = format!( + r#"{{"query":"mutation refreshToken($input: RefreshTokenInput!) {{ refreshToken(refreshToken: $input) {{ activeSession {{ sessionId }} }} }}","variables":{{"input":{{"refreshToken":"{}"}}}}}}"#, + refresh_token.unwrap() + ); + + let graphql_result = client + .post(graphql_url) + .header("authorization", auth_header) + .header("content-type", "application/json") + .body(graphql_payload) + .send() + .await; + + if graphql_result.is_err() { + return UnlockItem { + name: "Disney+".to_string(), + status: "Failed (Network Connection)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + // 检查 Disney+ 主页的可用性 + let preview_check = client.get("https://disneyplus.com").send().await; + + let is_unavailable = match preview_check { + Ok(response) => { + let url = response.url().to_string(); + url.contains("preview") || url.contains("unavailable") + } + Err(_) => true, + }; + + // 解析 GraphQL 响应获取区域信息 + let graphql_response = graphql_result.unwrap(); + let graphql_status = graphql_response.status(); + let graphql_body_text = (graphql_response.text().await).unwrap_or_default(); + + // 如果 GraphQL 响应为空或明显错误,尝试直接获取区域信息 + if graphql_body_text.is_empty() || graphql_status.as_u16() >= 400 { + // 尝试直接从主页获取区域信息 + let region_from_main = match client.get("https://www.disneyplus.com/").send().await { + Ok(response) => match response.text().await { + Ok(body) => { + let region_re = Regex::new(r#"region"\s*:\s*"([^"]+)"#).unwrap(); + region_re + .captures(&body) + .and_then(|caps| caps.get(1).map(|m| m.as_str().to_string())) + } + Err(_) => None, + }, + Err(_) => None, + }; + + if let Some(region) = region_from_main { + let emoji = country_code_to_emoji(®ion); + return UnlockItem { + name: "Disney+".to_string(), + status: "Yes".to_string(), + region: Some(format!("{}{} (from main page)", emoji, region)), + check_time: Some(get_local_date_string()), + }; + } + + // 如果主页也无法获取区域信息,返回详细错误 + if graphql_body_text.is_empty() { + return UnlockItem { + name: "Disney+".to_string(), + status: format!( + "Failed (GraphQL error: empty response, status: {})", + graphql_status.as_u16() + ), + region: None, + check_time: Some(get_local_date_string()), + }; + } else { + return UnlockItem { + name: "Disney+".to_string(), + status: format!( + "Failed (GraphQL error: {}, status: {})", + graphql_body_text.chars().take(50).collect::() + "...", + graphql_status.as_u16() + ), + region: None, + check_time: Some(get_local_date_string()), + }; + } + } + + // 提取国家代码 + let region_re = Regex::new(r#""countryCode"\s*:\s*"([^"]+)"#).unwrap(); + let region_code = region_re + .captures(&graphql_body_text) + .and_then(|caps| caps.get(1).map(|m| m.as_str().to_string())); + + // 提取支持状态 + let supported_re = Regex::new(r#""inSupportedLocation"\s*:\s*(false|true)"#).unwrap(); + let in_supported_location = supported_re + .captures(&graphql_body_text) + .and_then(|caps| caps.get(1).map(|m| m.as_str() == "true")); + + // 判断结果 + if region_code.is_none() { + // 尝试直接从主页获取区域信息 + let region_from_main = match client.get("https://www.disneyplus.com/").send().await { + Ok(response) => match response.text().await { + Ok(body) => { + let region_re = Regex::new(r#"region"\s*:\s*"([^"]+)"#).unwrap(); + region_re + .captures(&body) + .and_then(|caps| caps.get(1).map(|m| m.as_str().to_string())) + } + Err(_) => None, + }, + Err(_) => None, + }; + + if let Some(region) = region_from_main { + let emoji = country_code_to_emoji(®ion); + return UnlockItem { + name: "Disney+".to_string(), + status: "Yes".to_string(), + region: Some(format!("{}{} (from main page)", emoji, region)), + check_time: Some(get_local_date_string()), + }; + } + + return UnlockItem { + name: "Disney+".to_string(), + status: "No".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + let region = region_code.unwrap(); + + // 判断日本地区 + if region == "JP" { + let emoji = country_code_to_emoji("JP"); + return UnlockItem { + name: "Disney+".to_string(), + status: "Yes".to_string(), + region: Some(format!("{}{}", emoji, region)), + check_time: Some(get_local_date_string()), + }; + } + + // 判断不可用区域 + if is_unavailable { + return UnlockItem { + name: "Disney+".to_string(), + status: "No".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + // 判断支持状态 + match in_supported_location { + Some(false) => { + let emoji = country_code_to_emoji(®ion); + UnlockItem { + name: "Disney+".to_string(), + status: "Soon".to_string(), + region: Some(format!("{}{}(即将上线)", emoji, region)), + check_time: Some(get_local_date_string()), + } + } + Some(true) => { + let emoji = country_code_to_emoji(®ion); + UnlockItem { + name: "Disney+".to_string(), + status: "Yes".to_string(), + region: Some(format!("{}{}", emoji, region)), + check_time: Some(get_local_date_string()), + } + } + None => UnlockItem { + name: "Disney+".to_string(), + status: format!("Failed (Error: Unknown region status for {})", region), + region: None, + check_time: Some(get_local_date_string()), + }, + } +} + +// 测试 Amazon Prime Video +async fn check_prime_video(client: &Client) -> UnlockItem { + // 访问 Prime Video 主页 + let url = "https://www.primevideo.com"; + + let result = client.get(url).send().await; + + // 检查网络连接 + if result.is_err() { + return UnlockItem { + name: "Prime Video".to_string(), + status: "Failed (Network Connection)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + // 解析响应内容 + match result.unwrap().text().await { + Ok(body) => { + // 检查是否被地区限制 + let is_blocked = body.contains("isServiceRestricted"); + + // 提取地区信息 + let region_re = Regex::new(r#""currentTerritory":"([^"]+)"#).unwrap(); + let region_code = region_re + .captures(&body) + .and_then(|caps| caps.get(1).map(|m| m.as_str().to_string())); + + // 判断结果 + if is_blocked { + return UnlockItem { + name: "Prime Video".to_string(), + status: "No (Service Not Available)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + if let Some(region) = region_code { + let emoji = country_code_to_emoji(®ion); + return UnlockItem { + name: "Prime Video".to_string(), + status: "Yes".to_string(), + region: Some(format!("{}{}", emoji, region)), + check_time: Some(get_local_date_string()), + }; + } + + // 页面解析错误 + if !is_blocked && region_code.is_none() { + return UnlockItem { + name: "Prime Video".to_string(), + status: "Failed (Error: PAGE ERROR)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }; + } + + // 未知错误 + UnlockItem { + name: "Prime Video".to_string(), + status: "Failed (Error: Unknown Region)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + } + } + Err(_) => UnlockItem { + name: "Prime Video".to_string(), + status: "Failed (Error: Cannot read response)".to_string(), + region: None, + check_time: Some(get_local_date_string()), + }, + } +} + +// 获取所有解锁项目的列表 +#[command] +pub async fn get_unlock_items() -> Result, String> { + let items = vec![ + UnlockItem { + name: "哔哩哔哩大陆".to_string(), + status: "Pending".to_string(), + region: None, + check_time: None, + }, + UnlockItem { + name: "哔哩哔哩港澳台".to_string(), + status: "Pending".to_string(), + region: None, + check_time: None, + }, + UnlockItem { + name: "ChatGPT iOS".to_string(), + status: "Pending".to_string(), + region: None, + check_time: None, + }, + UnlockItem { + name: "ChatGPT Web".to_string(), + status: "Pending".to_string(), + region: None, + check_time: None, + }, + UnlockItem { + name: "Gemini".to_string(), + status: "Pending".to_string(), + region: None, + check_time: None, + }, + UnlockItem { + name: "Youtube Premium".to_string(), + status: "Pending".to_string(), + region: None, + check_time: None, + }, + UnlockItem { + name: "Bahamut Anime".to_string(), + status: "Pending".to_string(), + region: None, + check_time: None, + }, + UnlockItem { + name: "Netflix".to_string(), + status: "Pending".to_string(), + region: None, + check_time: None, + }, + UnlockItem { + name: "Disney+".to_string(), + status: "Pending".to_string(), + region: None, + check_time: None, + }, + UnlockItem { + name: "Prime Video".to_string(), + status: "Pending".to_string(), + region: None, + check_time: None, + }, + ]; + + Ok(items) +} + +// 开始检测流媒体解锁状态 +#[command] +pub async fn check_media_unlock() -> Result, String> { + // 创建一个http客户端 + let client = match Client::builder() + .user_agent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36") + .build() { + Ok(client) => client, + Err(e) => return Err(format!("创建HTTP客户端失败: {}", e)), + }; + + // 创建共享的结果集 + let results = Arc::new(Mutex::new(Vec::new())); + + // 创建一个任务集,用于并行处理所有检测 + let mut tasks = JoinSet::new(); + + // 共享的Client实例 + let client_arc = Arc::new(client); + + // 添加哔哩哔哩大陆检测任务 + { + let client = client_arc.clone(); + let results = results.clone(); + tasks.spawn(async move { + let result = check_bilibili_china_mainland(&client).await; + let mut results = results.lock().await; + results.push(result); + }); + } + + // 添加哔哩哔哩港澳台检测任务 + { + let client = client_arc.clone(); + let results = results.clone(); + tasks.spawn(async move { + let result = check_bilibili_hk_mc_tw(&client).await; + let mut results = results.lock().await; + results.push(result); + }); + } + + // 添加合并的ChatGPT检测任务 + { + let client = client_arc.clone(); + let results = results.clone(); + tasks.spawn(async move { + let chatgpt_results = check_chatgpt_combined(&client).await; + let mut results = results.lock().await; + results.extend(chatgpt_results); + }); + } + + // 添加Gemini检测任务 + { + let client = client_arc.clone(); + let results = results.clone(); + tasks.spawn(async move { + let result = check_gemini(&client).await; + let mut results = results.lock().await; + results.push(result); + }); + } + + // 添加YouTube Premium检测任务 + { + let client = client_arc.clone(); + let results = results.clone(); + tasks.spawn(async move { + let result = check_youtube_premium(&client).await; + let mut results = results.lock().await; + results.push(result); + }); + } + + // 添加动画疯检测任务 + { + let client = client_arc.clone(); + let results = results.clone(); + tasks.spawn(async move { + let result = check_bahamut_anime(&client).await; + let mut results = results.lock().await; + results.push(result); + }); + } + + // 添加 Netflix 检测任务 + { + let client = client_arc.clone(); + let results = results.clone(); + tasks.spawn(async move { + let result = check_netflix(&client).await; + let mut results = results.lock().await; + results.push(result); + }); + } + + // 添加 Disney+ 检测任务 + { + let client = client_arc.clone(); + let results = results.clone(); + tasks.spawn(async move { + let result = check_disney_plus(&client).await; + let mut results = results.lock().await; + results.push(result); + }); + } + + // 添加 Prime Video 检测任务 + { + let client = client_arc.clone(); + let results = results.clone(); + tasks.spawn(async move { + let result = check_prime_video(&client).await; + let mut results = results.lock().await; + results.push(result); + }); + } + + // 等待所有任务完成 + while let Some(res) = tasks.join_next().await { + if let Err(e) = res { + eprintln!("任务执行失败: {}", e); + } + } + + // 获取所有结果 + let results = Arc::try_unwrap(results) + .expect("无法获取结果,可能仍有引用存在") + .into_inner(); + + Ok(results) +} diff --git a/src-tauri/src/cmd/mod.rs b/src-tauri/src/cmd/mod.rs index 1ff5645e..7be1663c 100644 --- a/src-tauri/src/cmd/mod.rs +++ b/src-tauri/src/cmd/mod.rs @@ -6,6 +6,7 @@ pub type CmdResult = Result; // Command modules pub mod app; pub mod clash; +pub mod media_unlock_checker; pub mod network; pub mod profile; pub mod proxy; @@ -20,6 +21,7 @@ pub mod webdav; // Re-export all command functions for backwards compatibility pub use app::*; pub use clash::*; +pub use media_unlock_checker::*; pub use network::*; pub use profile::*; pub use proxy::*; diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index b52508f9..43420a21 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -209,6 +209,9 @@ pub fn run() { cmd::export_diagnostic_info, // get system info for display cmd::get_system_info, + // media unlock checker + cmd::get_unlock_items, + cmd::check_media_unlock, ]); #[cfg(debug_assertions)] diff --git a/src/components/center.tsx b/src/components/center.tsx new file mode 100644 index 00000000..8204c327 --- /dev/null +++ b/src/components/center.tsx @@ -0,0 +1,21 @@ +import { Box, BoxProps } from "@mui/material"; +import React from "react"; + +interface CenterProps extends BoxProps { + children: React.ReactNode; +} + +export const Center: React.FC = ({ children, ...props }) => { + return ( + + {children} + + ); +}; diff --git a/src/locales/en.json b/src/locales/en.json index 7d351532..df766b85 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -22,6 +22,7 @@ "Label-Connections": "Connections", "Label-Rules": "Rules", "Label-Logs": "Logs", + "Label-Unlock": "Test", "Label-Settings": "Settings", "Proxies": "Proxies", "Proxy Groups": "Proxy Groups", @@ -190,6 +191,7 @@ "Clear": "Clear", "Test": "Test", "Test All": "Test All", + "Testing...": "Testing...", "Create Test": "Create Test", "Edit Test": "Edit Test", "Icon": "Icon", @@ -555,5 +557,13 @@ "ORG": "ORG", "Location": "Location", "Timezone": "Timezone", - "Auto refresh": "Auto refresh" + "Auto refresh": "Auto refresh", + "Unlock Test": "Unlock Test", + "Pending": "Pending", + "Yes": "Yes", + "No": "No", + "Failed": "Failed", + "Completed": "Completed", + "Bahamut Anime": "Bahamut Anime", + "Disallowed ISP": "Disallowed ISP" } diff --git a/src/locales/zh.json b/src/locales/zh.json index 511ddaff..6556dc6d 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -22,6 +22,7 @@ "Label-Connections": "连 接", "Label-Rules": "规 则", "Label-Logs": "日 志", + "Label-Unlock": "测 试", "Label-Settings": "设 置", "Proxies": "代理", "Proxy Groups": "代理组", @@ -190,6 +191,7 @@ "Clear": "清除", "Test": "测试", "Test All": "测试全部", + "Testing...": "测试中...", "Create Test": "新建测试", "Edit Test": "编辑测试", "Icon": "图标", @@ -555,5 +557,13 @@ "ORG": "组织", "Location": "位置", "Timezone": "时区", - "Auto refresh": "自动刷新" + "Auto refresh": "自动刷新", + "Unlock Test": "解锁测试", + "Pending": "待检测", + "Yes": "支持", + "No": "不支持", + "Failed": "测试失败", + "Completed": "检测完成", + "Bahamut Anime": "动画疯", + "Disallowed ISP": "不允许的 ISP" } diff --git a/src/pages/_routers.tsx b/src/pages/_routers.tsx index 2c72187b..c40b72bd 100644 --- a/src/pages/_routers.tsx +++ b/src/pages/_routers.tsx @@ -5,6 +5,7 @@ import SettingsPage from "./settings"; import ConnectionsPage from "./connections"; import RulesPage from "./rules"; import HomePage from "./home"; +import UnlockPage from "./unlock"; import { BaseErrorBoundary } from "@/components/base"; import ProxiesSvg from "@/assets/image/itemicon/proxies.svg?react"; @@ -22,6 +23,7 @@ import SubjectRoundedIcon from "@mui/icons-material/SubjectRounded"; import WifiTetheringRoundedIcon from "@mui/icons-material/WifiTetheringRounded"; import SettingsRoundedIcon from "@mui/icons-material/SettingsRounded"; import HomeRoundedIcon from "@mui/icons-material/HomeRounded"; +import LockOpenRoundedIcon from "@mui/icons-material/LockOpenRounded"; export const routers = [ { @@ -60,6 +62,12 @@ export const routers = [ icon: [, ], element: , }, + { + label: "Label-Unlock", + path: "/unlock", + icon: [], + element: , + }, { label: "Label-Settings", path: "/settings", diff --git a/src/pages/unlock.tsx b/src/pages/unlock.tsx new file mode 100644 index 00000000..e0e9505d --- /dev/null +++ b/src/pages/unlock.tsx @@ -0,0 +1,395 @@ +import { useEffect, useState } from "react"; +import { + Box, + Button, + Card, + Divider, + Typography, + Chip, + Tooltip, + CircularProgress, + alpha, + useTheme, +} from "@mui/material"; +import Grid from "@mui/material/Grid2"; +import { useTranslation } from "react-i18next"; +import { invoke } from "@tauri-apps/api/core"; +import { BasePage, BaseEmpty } from "@/components/base"; +import { useLockFn } from "ahooks"; +import { + CheckCircleOutlined, + CancelOutlined, + HelpOutline, + PendingOutlined, + RefreshRounded, + AccessTimeOutlined, +} from "@mui/icons-material"; + +// 定义流媒体检测项类型 +interface UnlockItem { + name: string; + status: string; + region?: string | null; + check_time?: string | null; +} + +// 用于存储测试结果的本地存储键名 +const UNLOCK_RESULTS_STORAGE_KEY = "clash_verge_unlock_results"; +const UNLOCK_RESULTS_TIME_KEY = "clash_verge_unlock_time"; + +const UnlockPage = () => { + const { t } = useTranslation(); + const theme = useTheme(); + + // 保存所有流媒体检测项的状态 + const [unlockItems, setUnlockItems] = useState([]); + // 是否正在执行全部检测 + const [isCheckingAll, setIsCheckingAll] = useState(false); + // 记录正在检测中的项目 + const [loadingItems, setLoadingItems] = useState([]); + // 最后检测时间 + const [lastCheckTime, setLastCheckTime] = useState(null); + + // 按首字母排序项目 + const sortItemsByName = (items: UnlockItem[]) => { + return [...items].sort((a, b) => a.name.localeCompare(b.name)); + }; + + // 保存测试结果到本地存储 + const saveResultsToStorage = (items: UnlockItem[], time: string | null) => { + try { + localStorage.setItem(UNLOCK_RESULTS_STORAGE_KEY, JSON.stringify(items)); + if (time) { + localStorage.setItem(UNLOCK_RESULTS_TIME_KEY, time); + } + } catch (err) { + console.error("Failed to save results to storage:", err); + } + }; + + // 从本地存储加载测试结果 + const loadResultsFromStorage = (): { + items: UnlockItem[] | null; + time: string | null; + } => { + try { + const itemsJson = localStorage.getItem(UNLOCK_RESULTS_STORAGE_KEY); + const time = localStorage.getItem(UNLOCK_RESULTS_TIME_KEY); + + if (itemsJson) { + return { + items: JSON.parse(itemsJson) as UnlockItem[], + time, + }; + } + } catch (err) { + console.error("Failed to load results from storage:", err); + } + + return { items: null, time: null }; + }; + + // 页面加载时获取初始检测项列表 + useEffect(() => { + // 尝试从本地存储加载上次测试结果 + const { items: storedItems, time } = loadResultsFromStorage(); + + if (storedItems && storedItems.length > 0) { + // 如果有存储的结果,优先使用 + setUnlockItems(storedItems); + setLastCheckTime(time); + + // 后台同时获取最新的初始状态(但不更新UI) + getUnlockItems(false); + } else { + // 没有存储的结果,获取初始状态 + getUnlockItems(true); + } + }, []); + + // 获取所有解锁检测项列表 + const getUnlockItems = async (updateUI: boolean = true) => { + try { + const items = await invoke("get_unlock_items"); + const sortedItems = sortItemsByName(items); + + if (updateUI) { + setUnlockItems(sortedItems); + } + } catch (err: any) { + console.error("Failed to get unlock items:", err); + } + }; + + // 执行全部项目检测 + const checkAllMedia = useLockFn(async () => { + try { + setIsCheckingAll(true); + const result = await invoke("check_media_unlock"); + const sortedItems = sortItemsByName(result); + + // 更新UI + setUnlockItems(sortedItems); + const currentTime = new Date().toLocaleString(); + setLastCheckTime(currentTime); + + // 保存结果到本地存储 + saveResultsToStorage(sortedItems, currentTime); + + setIsCheckingAll(false); + } catch (err: any) { + setIsCheckingAll(false); + console.error("Failed to check media unlock:", err); + } + }); + + // 根据项目名称检测单个流媒体服务 + const checkSingleMedia = useLockFn(async (name: string) => { + try { + // 将该项目添加到加载状态 + setLoadingItems((prev) => [...prev, name]); + + // 执行检测 + const result = await invoke("check_media_unlock"); + + // 找到对应的检测结果 + const targetItem = result.find((item: UnlockItem) => item.name === name); + + if (targetItem) { + // 更新单个检测项结果并按名称排序 + const updatedItems = sortItemsByName( + unlockItems.map((item: UnlockItem) => + item.name === name ? targetItem : item, + ), + ); + + // 更新UI + setUnlockItems(updatedItems); + const currentTime = new Date().toLocaleString(); + setLastCheckTime(currentTime); + + // 保存结果到本地存储 + saveResultsToStorage(updatedItems, currentTime); + } + + // 移除加载状态 + setLoadingItems((prev) => prev.filter((item) => item !== name)); + } catch (err: any) { + setLoadingItems((prev) => prev.filter((item) => item !== name)); + console.error(`Failed to check ${name}:`, err); + } + }); + + // 获取状态对应的颜色 + const getStatusColor = (status: string) => { + if (status === "Pending") return "default"; + if (status === "Yes") return "success"; + if (status === "No") return "error"; + if (status === "Soon") return "warning"; + if (status.includes("Failed")) return "error"; + if (status === "Completed") return "info"; + if ( + status === "Disallowed ISP" || + status === "Blocked" || + status === "Unsupported Country" + ) { + return "error"; + } + return "default"; + }; + + // 获取状态对应的图标 + const getStatusIcon = (status: string) => { + if (status === "Pending") return ; + if (status === "Yes") return ; + if (status === "No") return ; + if (status === "Soon") return ; + if (status.includes("Failed")) return ; + return ; + }; + + // 获取状态对应的背景色 + const getStatusBgColor = (status: string) => { + if (status === "Yes") return alpha(theme.palette.success.main, 0.05); + if (status === "No") return alpha(theme.palette.error.main, 0.05); + if (status === "Soon") return alpha(theme.palette.warning.main, 0.05); + if (status.includes("Failed")) return alpha(theme.palette.error.main, 0.03); + if (status === "Completed") return alpha(theme.palette.info.main, 0.05); + return "transparent"; + }; + + // 获取状态对应的边框色 + const getStatusBorderColor = (status: string) => { + if (status === "Yes") return theme.palette.success.main; + if (status === "No") return theme.palette.error.main; + if (status === "Soon") return theme.palette.warning.main; + if (status.includes("Failed")) return theme.palette.error.main; + if (status === "Completed") return theme.palette.info.main; + return theme.palette.divider; + }; + + const isDark = theme.palette.mode === "dark"; + + return ( + + + + } + > + {unlockItems.length === 0 ? ( + + + + ) : ( + + {unlockItems.map((item) => ( + + + + + + {item.name} + + + + + + + + + + + + {item.region && ( + + )} + + + + + + + + {item.check_time || "-- --"} + + + + + ))} + + )} + + ); +}; + +export default UnlockPage;