Skip to content

Instantly share code, notes, and snippets.

View yumusb's full-sized avatar
🎯
Focusing

榆木 yumusb

🎯
Focusing
View GitHub Profile
@yumusb
yumusb / main.sh
Last active February 9, 2023 07:33
判断是否可用openai
if [[ $(curl -sS https://chat.openai.com/ -I | grep "text/plain") != "" ]]
then
echo "IP被BAN"
else
iso2_code=$(curl -sS https://chat.openai.com/cdn-cgi/trace | grep "loc=" | awk -F= '{print $2}')
country=$(curl -sS https://raw.githubusercontent.com/lukes/ISO-3166-Countries-with-Regional-Codes/master/all/all.csv | grep ",$iso2_code," | awk -F, '{print $1}')
country=$(echo ${country/\"/})
if [[ $(curl -sS "https://openaiapi-site.azureedge.net/public-assets/d/7f4419c385/static/js/main.3133adcb.js" | grep "\"${country}\"") != "" ]]
then
echo "可正常使用"