get recommended server for country name
- this could easily be memoized, and selected by either two letter code or country name from the JSON in a source file
- obvs Im passing the returned recommended server to openpyn
countryName=$1
if [ -z $countryName ]
then
countryName="Germany"
countryID=81
else
countryID=`curl --silent "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output 'map(del(.cities)) | .[] | select(.name == '\"$countryName\"') | .id'`
fi
echo "{ \"countryName\": \"$countryName\", \"countryID\": $countryID }" >&2
curl --silent https://nordvpn.com/wp-admin/admin-ajax.php -G -d "action=servers_recommendations&filters={%22country_id%22:$countryID}" | jq .[0].hostname -r | sed 's/\.nordvpn\.com$//' | cut -d'.' -f1
do you want me to code something like this up for openpyn?
get recommended server for country name