Skip to content

Commit

Permalink
fix Netflix check
Browse files Browse the repository at this point in the history
  • Loading branch information
lmc999 authored Feb 10, 2024
1 parent 25d69ae commit 303a0d4
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -403,24 +403,23 @@ function MediaUnlockTest_BBCiPLAYER() {
}

function MediaUnlockTest_Netflix() {
local result1=$(curl $useNIC $usePROXY $xForward -${1} --user-agent "${UA_Browser}" -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/81280792" 2>&1)
local result2=$(curl $useNIC $usePROXY $xForward -${1} --user-agent "${UA_Browser}" -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/70143836" 2>&1)
local tmpresult1=$(curl $useNIC $usePROXY $xForward -${1} --user-agent "${UA_Browser}" -fsL --max-time 10 "https://www.netflix.com/title/81280792" 2>&1)
local tmpresult2=$(curl $useNIC $usePROXY $xForward -${1} --user-agent "${UA_Browser}" -fsL --max-time 10 "https://www.netflix.com/title/70143836" 2>&1)
local result1=$(echo $tmpresult1 | grep -oP '"isPlayable":\K(true|false)')
local result2=$(echo $tmpresult2 | grep -oP '"isPlayable":\K(true|false)')

if [[ "$result1" == "404" ]] && [[ "$result2" == "404" ]]; then
if [[ "$result1" == "false" ]] && [[ "$result2" == "false" ]]; then
echo -n -e "\r Netflix:\t\t\t\t${Font_Yellow}Originals Only${Font_Suffix}\n"
return
elif [[ "$result1" == "403" ]] && [[ "$result2" == "403" ]]; then
elif [ -z "$result1" ] && [ -z "$result2" ]; then
echo -n -e "\r Netflix:\t\t\t\t${Font_Red}No${Font_Suffix}\n"
return
elif [[ "$result1" == "200" ]] || [[ "$result2" == "200" ]]; then
local region=$(curl $useNIC $usePROXY $xForward -${1} --user-agent "${UA_Browser}" -fs --max-time 10 --write-out %{redirect_url} --output /dev/null "https://www.netflix.com/title/80018499" 2>&1 | cut -d '/' -f4 | cut -d '-' -f1 | tr [:lower:] [:upper:])
if [[ ! -n "$region" ]]; then
region="US"
fi
elif [[ "$result1" == "true" ]] || [[ "$result2" == "true" ]]; then
local region=$(echo $tmpresult1 | grep -oP '"requestCountry":{"id":"\K\w\w' | head -n 1)
echo -n -e "\r Netflix:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n"
return
elif [[ "$result1" == "000" ]]; then
echo -n -e "\r Netflix:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
else
echo -n -e "\r Netflix:\t\t\t\t${Font_Red}Failed${Font_Suffix}\n"
return
fi
}
Expand Down

0 comments on commit 303a0d4

Please sign in to comment.